Quote to Sales Order Creation
  • 08 Nov 2024
  • 1 Minute to read
  • Dark
    Light

Quote to Sales Order Creation

  • Dark
    Light

Article summary

Purpose

Allows you to run a script when users create an ERP sales order, to set default values for specified fields on the New Order screen. In the script, define custom logic for setting default field values, leveraging data from various lookup tables.

By using this extension point, you can tailor the sales office assignment and other relevant attributes in the Sales Order object to meet your unique business requirements.

Setup

Upload the script for Quote to Sales Order Creation.

For details about uploading and configuring Groovy scripts, read Upload a Groovy script.

Binding variables

In addition to the common binding variables, the following binding variables are available for this extension point.

Variable nameClassDescription
orderOrder Represents the order.
salesItemsTreeSalesItemsTree Represents the quote. Contains functions you can use to query and modify the quote and its line items.
userInfoUserInfo Represents all users in the system.

Sample script

Use the following sample Groovy script to upload for this extension point:

import com.imc.iss.groovy.salesitem.SalesItemsTree;
import com.imc.iss.groovy.GroovyCtxUtil
import com.imc.iss.groovy.GroovyLogger
import com.imc.iss.groovy.order.Order
import com.imc.iss.groovy.order.OrderItem
import com.imc.vocabulary.Schema

/*
 * 
 * 
 *    
 *  Binding
 *  groovyLogger : GroovyLogger
 *  groovyCtxUtil : GroovyCtxUtil
 *  order : Order
 *  salesItemsTree
 *  userInfoList
 *  lookuptable/view and other default binding
 */

def creatorName = userInfo.getUsername();
groovyLogger.notifyInfo("creatorName = "+ creatorName)

groovyLogger.notifyInfo("Quote ID : "+ salesItemsTree.getQuoteURI());

//groovyLogger.notifyError("Quote ID : "+ salesItemsTree.getQuoteURI());

//Logic to get relevant OrgUnits to set default Sales Office and Sales Organization values
//MX Office Equipment
def salesOrg = "https://<base_url>/OrgUnit#ffaaf902baea429f92451aba6384f407";

//MX Office Equipment DE
def salesOffice = "https://<base_url>/OrgUnit#f7aefaad605d4800a81ace7d381e5883";

groovyLogger.notifyInfo("salesOrg : "+ salesOrg);
groovyLogger.notifyInfo("salesOffice : "+ salesOffice);

order.setRelationAttribute(Schema.hasSalesOffice.getUriAsString(), salesOffice);
order.setRelationAttribute(Schema.hasSalesOrg.getUriAsString(), salesOrg);

Expected output

No output expected.

Script execution

A script that you upload for this extension point is run automatically when a user creates a sales order from a submitted quote.

Create a sales order

  1. Open a quote.
  2. From the bottom button bar, select ERP Helpers > Order.
  3. From the bottom button bar, select Generate Sales Orders.
    Zilliant CPQ executes the uploaded Groovy script. On the New Order screen, on the Overview tab, default values of specific fields follow the logic defined in the script.

Was this article helpful?

What's Next
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.