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
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.
The quote business object
The data about the sales order
The ERP ID of generated sales order, as a String.
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:
String orderType = "";
def userBO = userInfo.getUserBO();
def personBO = groovyCtxUtil.getRelAttr(userBO, Schema.containsPerson);
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
Article is closed for comments.