This Extension Point allows a script to be executed when ERP Sales Order is created, so that a custom implementation can be done instead of using the standard behavior.
Creating ERP Sales Orders from CPQ
Initial Setup
Upload the script file to the Groovy Script with the name “Create ERP Sales Order". Please refer to Groovy Service Introduction - Uploading a New Groovy Script for more details of how to do this.
The usage of this script must be enabled separately through a system setting. In Administration > Master Data Management > SettingBoolean, search for “Setting Custom Implementation for Sales Document Creation In ERP” and set the Setting Value Boolean to Yes.
Additional Binding Variables
The following binding variable(s) are made available for this extension point, in addition to the common binding variables listed in Groovy Service Introduction - Common Binding Variables.
Variable Name |
Class |
Description |
---|---|---|
quoteBO |
BusinessObject |
The quote business object |
salesOrderDTO |
JSONBusinessObjectDTO |
The data about the sales order |
Expected Output
The ERP ID of generated sales order, as a String.
Script Execution
The script that has been uploaded for this extension point will be executed automatically when the user creates the ERP Sales Order in the ERP Helpers screen, if the setting has been enabled. Please consult the ERP Integration Guide on the details of how to perform this action.
Creating ERP Sales Orders from Commerce
Following groovy script can be used to define the sales order type when a Commerce order is placed in ERP. This gives users the flexibility to conditionally set the sales order type in order creation.
Sample groovy script for defaulting the sales order type based on Sales Organization when creating an order in Commerce:
import com.imc.iss.groovy.GroovyLogger;
import com.imc.iss.groovy.GroovyCtxUtil;
import com.imc.vocabulary.Schema;
String orderType = "";
def userBO = userInfo.getUserBO();
def personBO = groovyCtxUtil.getRelAttr(userBO, Schema.containsPerson);
groovyCtxUtil.loadBO(personBO);
def accountBO = groovyCtxUtil.getRelAttr(personBO, Schema.contactContainedBy);
def salesInfoBO = groovyCtxUtil.getRelAttr(accountBO, Schema.definesSalesInfo);
def salesOrg = groovyCtxUtil.getRelAttr(salesInfoBO, Schema.hasSalesOrg);
def salesOrgERPId = groovyCtxUtil.getObjectERPId(salesOrg);
// TODO: set the order type 'orderType' based on the sales area information
return orderType;
Comments
0 comments
Article is closed for comments.