Newer Version Available
Partner Order Submit API
The Partner Order Submit API can be used to submit orders immediately or asynchronously.
Syntax
1channel_orders.ServiceOrderProcessor.sendOrder()
2channel_orders.ServiceOrderProcessor.sendOrderAsync()Usage
Use sendOrderAsync when you want to create or update multiple orders and send them in the same transaction. See the example in this section for more details.
Rules and Guidelines
This is an Apex implementation, so all Apex usage rules and limits apply. Currently we only support 1 order per call.
The Partner Submit API is used to send an order after it has been created, using a valid Service Order ID. You can create Service Order and Service Order Detail records using the Channel Order App, data loading, or automated processing.
| Field Label | Field Name | Description |
|---|---|---|
| Created with New COA | Created_with_new_COA__c | Indicates you are using the latest version of the Channel Order App. |
| Contract | Partner_Contract_Rules__c | This field is a lookup to the Contract Terms record. |
| Customer Company Name | Customer__c | This field is a lookup to the Customer record, which includes the address and org details. |
| Date Partner Received Customer Order | Date_Partner_Received_Customer_Order__c | The date you received the order. |
| Date Customer Accepted SFDC Service Agreement | Date_Customer_Accepted_SFDC_Svc_Agrmnt__c | The date the customer accepted the salesforce.com service agreement. Only required for OEM contracts. |
| I Certify a Corresponding Order is Rec’d | I_certify__c | Confirmation that the order has been received. |
| Order Type | Order_Type__c | Accepted values:
|
| Service Order | Partner_Order__c | The ID of the service order. |
| Service Order Status1 | Service_Order_Status__c | The current status of the service order:
|
| Service Start Date | Service_Start_Date__c | The date service should begin. |
| Field Label | Field Name | Description |
|---|---|---|
| App | Application__c | The name of the app that corresponds to this product. |
| Billing Frequency | pc_Billing_Frequency__c | Must match contract with Salesforce unless you have been granted override permissions. |
| Cancellation Terms (days) | pc_Cancellation_Terms__c | Must match contract with Salesforce unless you have been granted override permissions. |
| Contract Auto Renew | pc_Contract_Auto_Renew__c | Must match contract with Salesforce unless you have been granted override permissions. |
| Contract Length | pc_Contract_Length__c | Must match contract with Salesforce unless you have been granted override permissions. |
| Currency | Currency__c | The default contract currency from the partner contract rules governing this order. Read-only. |
| Customer Price | Customer_Price_Per_Month__c | The price in units per month. Only required for PNR products. |
| Fixed Price | pc_Fixed_Price__c | The fixed price of the related product at the time the order was created. Must be explicitly set when using the API. |
| Floor Price | pc_Floor_Price__c | The floor price of the related product at the time the order was created. Must be explicitly set when using the API. |
| Partner Contract Term | pc_Partner_Contract_Term__c | This field is a lookup to the Contract Terms record. |
| PNR % | pc_PNR__c | The percent net revenue of the related product at the time the order was created. Must be explicitly set when using the API. |
| Pricing | pc_Pricing_Type__c | The pricing type of the related product at the time the order was created. Must be explicitly set when using the API. |
| Product | Product_Name__c | This field is a lookup to the Product Catalog record. |
| Product ID | pc_Product_ID__c | The ID of the related product at the time the order was created. Must be explicitly set when using the API. |
| Renewal Terms (months) | pc_Renewal_Terms__c | Must match contract with Salesforce unless you have been granted override permissions. |
| Service Order | Partner_Order__c | This field is a lookup to the Service Order. |
| SFDC Invoice Description | Product_Line_Description__c | Optional. This field should contain anything extra you want added to the invoice, including your identification information. |
| Total Quantity | Quantity__c | The total quantity of Product Catalogs in the service order. |
| Unit | pc_Pricing_Unit__c | The per-unit pricing method for the product. You can choose per user, per org, or define a custom method. This field is a lookup to the Product Catalog record. |
Methods
The ServiceOrderProcessor object supports the following methods:
| Name | Arguments | Description |
|---|---|---|
| sendOrder | ID | Submit an order with a single ID immediately. |
| sendOrder | Set of IDs | Submit an order with a set of IDs immediately. |
| sendOrderAsync | ID | Submit an order with a single ID asynchronously (@future). |
| sendOrderAsync | Set of IDs | Submit an order with a set of IDs asynchronously (@future). |
Example: Batching on the Partner Order Submit API
You can only invoke ServiceOrderProcessor once per Apex transaction. If you pass a set of IDs to sendOrder or sendOrderAsync, the maximum set size is 5. This example uses a batch job to work around this limitation.
1//Batch Apex class
2global class COABatchClass implements Database.batchable<sObject>, Database.AllowsCallouts, Database.Stateful{
3 final String DRAFT_STATUS = 'Draft';
4 global final String query =
5 'select Id, CHANNEL_ORDERS__Service_Order_Status__c ' +
6 ' from CHANNEL_ORDERS__Service_Order__c where CHANNEL_ORDERS__Service_Order_Status__c =: DRAFT_STATUS';
7
8 global Database.QueryLocator start(Database.BatchableContext BC){
9 return Database.getQueryLocator(query);
10 }
11
12 global void execute(Database.BatchableContext info, List<CHANNEL_ORDERS__Service_Order__c> scope){
13 for(CHANNEL_ORDERS__Service_Order__c s : scope){
14 CHANNEL_ORDERS.ServiceOrderProcessor.sendOrder(s.Id);
15 }
16 }
17 global void finish(Database.BatchableContext BC){}
18}
19
20//Batch call
21Id batchInstanceId = Database.executeBatch(new COABatchClass(), 1);