Successful work items

In your custom work queue class, return from the processWorkItem method after a worker finishes operating on a target instance. PolicyCenter then deletes the work item from the work queue.

The following example code extracts the targeted unit of work, an Activity instance, from the work item parameter. Then, the code sends the assigned user an email message.

override function processWorkItem (WorkItem : StandardWorkItem): void  {

   // Extract the unit of work: an Activity instance
  var activity = extractTarget(WorkItem)

  if (activity.AssignedUser.Contact.EmailAddress1 != null) {   
    // Send an email to the user assigned to the Activity.
    mailUtil.sendEmailWithBody(null, 
          activity.AssignedUser.Contact,                                                       // To:
          null,                                                                                // From:
          "Activity not viewed for five days",                                                 // Subject:
          "Take a look at activity " + target.Subject + ", due on " + target.TargetDate + ".") // Body:    
  }

  return

}

In your override of the base processWorkItem method, specify the same work item entity type that you specified in the constructor of your custom work queue class.