RE_Order.DoWork Interface

The RE_Order.DoWork Apex interface provides the capability to perform additional work after an order and the related records are committed to the database.

The transaction gets rolled back if there are any errors reported during the doWork execution.

Namespace 

1cgcloud

Example Implementation 

1cgcloud.RE_Order.DoWork;

Supported Methods 

doWork() 

Append the work to be executed after the order and its related records are committed to the database.

API Version: 59.0

Signature: global void doWork()

Example

1global class RetailOrderSaveCustomization implements System.Callable {
2  public class MyAfterCommitWork implements cgcloud.RE_Order.DoWork {
3    cgcloud__Order__c m_order = null;
4
5    MyAfterCommitWork(cgcloud__Order__c order) {
6      m_order = order;
7    }
8
9    // This method will be called after the order and related record
10    // changes are committed to the database.
11    // If any error is thrown during the execution of doWork, the transaction
12    // will be rolled back
13    global override void doWork() {
14      system.debug('Im here!');
15    }
16  }
17
18  public Object call(String m, Map<String, Object> params) {
19    cgcloud.RE_Order orderWrapper = (cgcloud.RE_Order) params.get('order');
20    cgcloud__Order__c order = (cgcloud__Order__c) orderWrapper.getOrder()
21      .getRecord();
22
23    orderWrapper.registerWork(new MyAfterCommitWork(order));
24    return null;
25  }
26}