Newer Version Available

This content describes an older version of this product. View Latest

COA_ServiceOrderClone Class

Clone an existing order in the org where the Channel Order App (COA) is installed.

Namespace

Only fields that you have permission to create are cloned. DML errors can occur if you don’t have sufficient privileges.

Note

CHANNEL_ORDERS

Usage

The COA_ServiceOrderClone class contains a single @InvocableMethod to clone orders and, optionally, associated line items. For annotation information, see the Apex Developer Guide.

Example

This example receives a list of service orders, clones them, and returns a list of outputs from the clone operation.
1public static void cloneOrders(List<Service_Order__c> serviceOrders){
2        List<COA_ServiceOrderClone.COA_ServiceOrderCloneInput> serviceOrderCloneInput = new List<COA_ServiceOrderClone.COA_ServiceOrderCloneInput>();
3
4        for(Service_Order__c serviceOrder: serviceOrders){
5            COA_ServiceOrderClone.COA_ServiceOrderCloneInput input = new COA_ServiceOrderClone.COA_ServiceOrderCloneInput();
6            input.serviceOrderId = serviceOrder.Id;
7            input.cloneProducts = true;
8            serviceOrderCloneInput.add(input);
9        }
10
11        List<COA_ServiceOrderClone.COA_ServiceOrderCloneOutput> serviceOrderCloneOutputs = COA_ServiceOrderClone.clone(serviceOrderCloneInput);
12        //Further processing of serviceOrderCloneOutputs
13    }