Mobile Agent–Adding Custom History Entries
One of the best things about Dovetail’s Mobile Agent is the ease of customization. Every customer has different business workflows, and that will lead to customization of their applications.
Cases are usually the primary activity in Mobile Agent, and there can be some custom activity that needs to be shown in the Case History. Getting those custom (or customized) activity entry records to show up in the history is a easy customization to do.
There are two things to do to get custom activity to be displayed. The first is to create the custom templates for the activity, and the second is to register the new template with Mobile Agent.
All of the activity templates derive from the ActEntryTemplatePolicyExpression class, so the new custom template needs to do the same. Here is an example of a custom template, added as the CustomActivityPolicy class:
using Dovetail.SDK.Bootstrap.History; using Dovetail.SDK.Bootstrap.History.Configuration; namespace Dovetail.Agent.Mobile.Configuration { public class CustomActivityPolicy : ActEntryTemplatePolicyExpression { protected override void DefineTemplate(WorkflowObject workflowObject) { ActEntry(94110).DisplayName("UPS Tracking"); } } }
This example is adding a new template for one custom activity code – 94110. The Display Name is being set here to give the history entry context about the activity. Here is the result from a Case Summary:
Registering the custom template is also a simple process. All that needs to be done is to add the custom template to the registry for the template policies, found in the MobileActEntryTemplatePolicyRegistry class. The last line shows the CustomActivityPolicy being registered:
using Dovetail.SDK.Bootstrap.History.Configuration; using Dovetail.SDK.Bootstrap.History.TemplatePolicies; namespace Dovetail.Agent.Mobile.Configuration { public class MobileActEntryTemplatePolicyRegistry : ActEntryTemplatePolicyRegistry { public MobileActEntryTemplatePolicyRegistry() { DefaultIs<WorkflowActEntryTemplatePolicy>(); Add<SubcaseActEntryTemplatePolicy>(); Add<SeekerAttachmentPolicy>(); Add<CustomActivityPolicy>(); } } }
This process wires it all up, and the Case Summary page will now include the custom history activity. The last policy to be registered will override any existing policies, so the registration order does matter.
In this example, a new entry was defined. Existing entries can also be removed or modified can be done in the custom template as well. This snippet shows some examples:
//you can remove templates created by other policies ActEntry(3000).Remove(); //you can modify existing policies ActEntry(900).DisplayName("Dys-patched") .EditActivityDTO(dto => { dto.Detail = "Dispatched to " + dto.Detail; });
That is all there is to getting custom history entries to show up in Mobile Agent.