- 15 May 2024
- 1 Minute to read
- Print
- DarkLight
Create ERP Sales Order
- Updated on 15 May 2024
- 1 Minute to read
- Print
- DarkLight
Purpose
Allows you to run a script to enable a custom implementation when an ERP sales order is created.
Create ERP sales orders from CPQ
Setup
Upload the script to the Groovy script with the name Create ERP Sales Order.
For details about uploading and configuring Groovy scripts, read Upload a Groovy script.
Enable the script
You must enable this script in system settings. Follow these steps:
- In the CPQ application, from the left navigation area, select Administration.
- From the top navigation bar, select Master Data Management.
- Select SettingBoolean.
- Search for Setting Custom Implementation for Sales Document Creation in ERP.
- Set the Setting Value Boolean switch to YES.
Binding variables
In addition to the common binding variables, the following binding variables are available for this extension point.
Variable name | Class | Description |
---|---|---|
quoteBO | BusinessObject | Quote business object |
salesOrderDTO | JSONBusinessObjectDTO | Data about the sales order |
Expected output
The ERP ID of the generated sales order, as a string.
Script execution
If the setting is enabled, the script is run automatically when a user creates an ERP sales order in the ERP Helpers screen.
Create ERP sales orders from Commerce
You can use a Groovy script to define the sales order type when a Commerce order is placed in the ERP. This gives you the flexibility to conditionally set the sales order type during order creation.
Sample script
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;
Setting a default sales document type during order creation
Setting a default sales document type:
- Enhances the efficiency of order creation. Including the "Defaulting Sales Document Type During Order Creation" feature helps make the order creation process more efficient. By enabling authorized users to specify a default sales document type through master data, you eliminate manual tasks and reduce the incidence of errors.
- Streamlines the user experience. When users initiate the order creation or order copying process, the system automates the assignment of the default sales document type. This reduces the need for manual selections and ensures consistency in order categorization.