COA_ServiceOrderEdit Class

Edit orders that you’ve submitted to Salesforce Partner Operations.

Namespace

CHANNEL_ORDERS

Usage

The COA_ServiceOrderEdit class contains a single @InvocableMethod for editing orders that have been submitted to Salesforce Partner Operations but haven’t been processed. When invoking a method defined in this class, include the CHANNEL_ORDERS namespace prefix:
CHANNEL_ORDERS.class.method(args)

For details about namespace prefixes or the @InvocableMethod annotation, see the Apex Developer Guide.

Example

This example receives a list of service orders that have been edited, submits them, and returns a list of outputs from the edit operation.

For brevity, the methods invoked in this example omit the CHANNEL_ORDERS namespace prefix. If you use this code in your implementation, you must include the namespace prefix.

Note

public static void editOrders(List<Service_Order__c> serviceOrders){
    List<COA_ServiceOrderEdit.COA_ServiceOrderEditInput> serviceOrderEditInput = new List<COA_ServiceOrderEdit.COA_ServiceOrderEditInput>();
    
    for(Service_Order__c serviceOrder: serviceOrders){
        COA_ServiceOrderEdit.COA_ServiceOrderEditInput input = new COA_ServiceOrderEdit.COA_ServiceOrderEditInput();
        input.serviceOrderId = serviceOrder.Id;
        serviceOrderEditInput.add(input);
    }
    
    List<COA_ServiceOrderEdit.COA_ServiceOrderEditOutput> serviceOrderEditOutputs = COA_ServiceOrderEdit.edit(serviceOrderEditInput);
        
    for(COA_ServiceOrderEdit.COA_ServiceOrderEditOutput serviceOrderEditOutput: serviceOrderEditOutputs){
        System.debug('Service Order Id: '+serviceOrderEditOutput.serviceOrderId);
        System.debug('Success?: '+serviceOrderEditOutput.isSuccess);             
        System.debug('Response Messages: '+serviceOrderEditOutput.responseMessages);
    }
}