Nextian enables order processing automation, integration and orchestration via ‘automated’ tasks.
Automated tasks call Salesforce APEX code rather than being assigned to queues and individuals for manual processing.
Automated and manual tasks can be mixed within a work order template with no limitations — e.g., it is possible to create a fully automated template for a zero-touch provisioning process.
Typically, automated tasks are used for third-party integrations (e.g., with provisioning or billing systems) or for performing complex transactions within Salesforce.
Automated tasks have all the fields and properties of manual tasks (dependencies, schedule, etc.) and carry additional information:
Call Method
Call Method is a name of an APEX class and its static method (Class.MethodName) called to execute the task. The method takes only one argument — the calling work order task id as a Salesforce Id type (retrieval of other pieces of information such as work order or service ids is up to the implementation).
The Method is an entry point only and can subsequently call other methods. The Class must be deployed on the org and the calling user (see below) must have access to it.
The called class must implement Salesforce callable interface (the callable interface enables dynamic/loosely coupled integrations between Apex classes or triggers).
An example class is shown below:
// Helper class (must be non-static as Callable requires non static classes): public with sharing class BillingHelper implements Callable { // Helper method (this method is static): public static void createBillingOrder(Id workOrderTaskId) { ... your processing here ... } // Callable interface implementation (not static): public Object call(String action, Map<String, Object> args) { // Retrieve calling task id: Id taskId = (Id)args.get('taskId'); if(taskId == null) { throw new CalloutException('Task id missing.'); } else if (action == 'createBillingOrder') { // this value passed from calling automated task (in this case BillingHelper.createBillingOrder) BillingHelper.createBillingOrder(taskId); return null; } else { ... other methods ... } } }
The helper method should return no value (and callable return is always null); however, any exception thrown will be caught and reported to the user interface and logged in the Error Message field of the calling task.
Task configuration to call BillingHelper.createBillingOrder above would look like:
Execution Type
Execution Type determines how Call Method is invoked:
Execution Type | Description |
---|---|
Manual | In this scenario, when a task becomes Ready, it is still assigned to a user or queue.
The user has to run the code manually by using Execute action on the task. The code is executed in the context of the user. |
Future Method | Call Method is automatically invoked when the task becomes Ready via a Salesforce future method. |
Batch Job | Call Method is automatically invoked when the task becomes Ready according the ‘Process Automated Tasks’ job schedule. |
Built-in Helper Methods
Service Analyzer provides an APEX helper class called AutomatedTask providing static methods for work order automation (users can add their own methods for billing systems- or provisioning integrations, additional automation in Salesforce and others):
The following helper methods are available:
Helper Method | Description |
---|---|
AutomatedTask.startService | Start service associated with the current work order (including the add-ons if present). |
AutomatedTask.cancelService | Cancel service associated with the current work order. |
AutomatedTask.updateServiceAddOns | Creates new service add-ons and deactivates canceled ones for the Change Service Add-Ons quote line item type. |