Use Managed Packages to Develop Your AgentExchange Solution
Service Order
Service Order Detail
Partner Order Submit API
OEM User License Guide
Previous Versions
Submit orders to Salesforce Partner Operations for processing and activation.
The COA_ServiceOrderSubmit class contains a single @InvocableMethod for submitting orders to Salesforce Partner Operations. When invoking a method defined in this class, include the CHANNEL_ORDERS namespace prefix:
1CHANNEL_ORDERS.CLASS.METHOD(ARGS)For details about namespace prefixes or the @InvocableMethod annotation, see the Apex Developer Guide.
This example receives a list of service orders, submits them, and returns a list of outputs from the submit 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
1public static void submitOrders(List<Service_Order__c> serviceOrders){
2 List<COA_ServiceOrderSubmit.COA_ServiceOrderSubmitInput> serviceOrderSubmitInput = new List<COA_ServiceOrderSubmit.COA_ServiceOrderSubmitInput>();
3
4 for(Service_Order__c serviceOrder: serviceOrders){
5 COA_ServiceOrderSubmit.COA_ServiceOrderSubmitInput input = new COA_ServiceOrderSubmit.COA_ServiceOrderSubmitInput();
6 input.serviceOrderId = serviceOrder.Id;
7 serviceOrderSubmitInput.add(input);
8 }
9
10 List<COA_ServiceOrderSubmit.COA_ServiceOrderSubmitOutput> serviceOrderSubmitOutputs = COA_ServiceOrderSubmit.submit(serviceOrderSubmitInput);
11
12 for(COA_ServiceOrderSubmit.COA_ServiceOrderSubmitOutput serviceOrderSubmitOutput: serviceOrderSubmitOutputs){
13 System.debug('Service Order Id: '+serviceOrderSubmitOutput.serviceOrderId);
14 System.debug('Success?: '+serviceOrderSubmitOutput.isSuccess);
15 System.debug('Response Messages: '+serviceOrderSubmitOutput.responseMessages);
16 }
17}When you submit a draft order using the COA_ServiceOrderSubmit class, the response tells you if the operation succeeded. The response doesn’t set the status of the related service order record, so the Service_Order_Status__c field remains Draft. If you build an implementation to set the status of submitted orders, we suggest the following logic: if the response includes a success code, set the order status to Received. Otherwise, set the status to Error. For orders with errors, you can store notes from Salesforce Partner Operations in the Error_Comment__c field.