I am kind of at my wits end at the moment and need some advice. We are maintaining a legacy site that someone developed in 7.3. One functionality that does not quite work right is the ability to send communications to the users. They call them alerts and notifications. They are both nearly the same except for the way that they are displayed to the users. This could be from a handful to tens of thousands (possibly over 120k). So I am only showing code for alerts.
The way they did it (note the code below), is that they create an alert. Then then loop through the user list passed in and create an AlertUser for each one and attach that to the parent. Once the list gets long enough, it never finishes. There is a global error handler that is supposed to log any errors and nothing is logged.
So I have two problems to solve. The first and foremost is to find a way to make this work. The second is to give the user some kind of progress indicator (we have been trying the RadProgressArea, but it disappears way before the process stops - we have a ticket opened on that). The latter could be eliminated if the former is quick enough.
Any suggestions would be appreciated.
Type AlertType = TypeResolutionService.ResolveType(
Type AlertUserType = TypeResolutionService.ResolveType(
, DateTime startTime
, DateTime expirationTime
, RadProgressContext progressContext
, HttpResponse response)
var processed =
// Set the provider name for the DynamicModuleManager here. All available providers are listed in
// Administration -> Settings -> Advanced -> DynamicModules -> Providers
var providerName =
var dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
var alertItem = dynamicModuleManager.CreateDataItem(AlertType);
// This is how values for the properties are set
// Make sure we are going to be running this twice on anyone.
// Was the cancel button clicked or was the browser closed? If so, cancel the operation
// This is how we add child items
var alertuserItem = CreateAlertUser(alertItem.Id, user.Key, user.Value);
// You need to call SaveChanges() in order for the items to be actually persisted to data store
// We can now call the following to publish the item
var publishedAlertItem = dynamicModuleManager.Lifecycle.Publish(alertItem);
//You need to set appropriate workflow status
DynamicContent CreateAlertUser(Guid parentId, Guid userId,
var alertuserItem = dynamicModuleManager.CreateDataItem(AlertUserType);
// Set item parent
var publishedAlertuserItem = dynamicModuleManager.Lifecycle.Publish(alertuserItem);