Create ERP Sales Order
  • 15 May 2024
  • 1 Minute to read
  • Dark
    Light

Create ERP Sales Order

  • Dark
    Light

Article summary

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:

  1. In the CPQ application, from the left navigation area, select Administration.
  2. From the top navigation bar, select Master Data Management.
  3. Select SettingBoolean.
  4. Search for Setting Custom Implementation for Sales Document Creation in ERP.
  5. 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 nameClassDescription
quoteBOBusinessObject Quote business object
salesOrderDTOJSONBusinessObjectDTO 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.

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.