In SAP CPQ scripts are managed in Setup under Develop > Global Scripts. A more detailed documentation for scripting is available on the dedicated Scripting page.

Details regarding all the scripts in the system are displayed in the following columns:

  • Name- The name of the script.
  • Execution Time -The execution event when the script is executed. The following available events trigger scripts at a precise time:
    1. Every time quote is changed - after each change on the quote that affects the Date Modified field.
    2. Quote creation/edit
      1. Quote creation - immediately after a quote is created.
      2. Quote edit - after the action Edit quote is executed.
    3. After adding products to quote
      1. After adding products to quote - each time an item is added. If several items are added at once (from catalog or through bulk validation), the scripts are executed after the last item (not after each item is added).
      2. After editing products in quote -after a user finishes editing a product in the quote.
      3. After copying products from quote - after a user copies a product in the quote.
      4. After deleting products from quote - after a user deletes an item in the quote. If several items are deleted at once, the scripts are executed after all items are deleted.
    4. After changing the value of custom fields - when a particular custom field is changed. For events that are triggered when a custom field is altered, you are able to select the custom field from the system.
    5. Custom fields calculation - after users choose the calculation type.
      1. Before custom field calculation - before the formula is calculated.
      2. After custom field calculation - after the formula is calculated.
    6. When a user is on quotation tab - when a user is on a particular tab in the quote. As soon as a user clicks on the particular tab, SAP CPQ executes the scripts specified for the tab. When the user clicks Save on this tab, the scripts specified for the tab are executed. The event is executed in the following tabs: Additional Info, Customer Info, Documents, Quotation and Quotation.
    7. When quote layout is rendered - when the customization related to the layout of the quote (modify XML and add additional data) that cannot be accomplished with simple changes to quote XSLT is performed. The event is deprecated in the new SAP CPQ layout.
    8. When catalog layout is rendered - when the customization related to the catalog of the quote (modify XML and add additional data) that cannot be accomplished with simple changes to quote XSLT is performed. The event is deprecated in the new SAP CPQ layout.
      1. On product xml serialization start - before the xml serialization starts.
      2. On product xml serialization end - when the xml serialization finishes.
    9. On Arrive From CRM - when users have arrived from SAP CPQ.
      1. On Customer Mappings - when creating and assigning customers to quotes.
      2. On Quote Fields Mappings - when retrieving different quote fields from CRM.
    10. On Landing From CRM - chronologically, happens before arriving from CRM and after the authentication handshake. This event has the request context.
    11. On CRM Item Mappings - when sending items from SAP CPQ to Salesforce. Applicable only when SAP CPQ is integrated with Salesforce.
    12. On Asset Created - after the action Create Assets is triggered.
    13. On user Login - when users log into SAP CPQ.
    14. On customer change - when the Bill To, Ship To and End User customers are changed.
    15. Document Sent To Customer - in the last step of the Document Generation process. Administrators can define a script that changes the status of the quote to Sent to Customer.
    16. On Quote Tab Changed - when moving to a quote tab (e.g. a script can be executed to create a quote table in the current tab).

When multiple scripts are attached to an event, it is possible to change their execution order by clicking the event > Execution order.

  • Code - holds code in Iron Python script language.
  • Description
  • Active - false and true.
  • Module - false and true.
  • Modified Date - the date when the script was last updated.
  • Modified By - the name of the user who last modified the script.

Create a Script

A script contains a series of commands that can be executed without being compiled. SAP CPQ provides a user-friendly interface for administrators to create and manage scripts.

  • In Setup, access Develop > Global Scripts.
  • Click Add New and a page with three tabs displays: Script (for creating and editing scripts), Events (for tying a script to an event) and History (for displaying all the versions of the script and the time and date of its creation/editing).
  • Define the Rule Name. Please note that the field is required.
  • (Optional) Describe the script in Description.
  • Select Active if you wish the script to be active in the system.
  • Select Module to use the code in other scripts. Please note that the scripts that have this option selected cannot be used independently, but only as a part of other scripts.
  • Define the start and end date of the script. These fields are disabled if Module is selected.
  • The Modified by and Modified on are disabled and the system automatically populates them once the script is saved.
  • In the Scripting Code section, choose the script engine type. SAP CPQ currently supports IronPython for creating scripts.
  • (Optional) Select Force Proxy Generation to load and refresh the WSDL web services as the system does not do it by default. The checkbox needs to be selected only once when the script is saved for the first time.
  • Write your script in the Script box.
  • Click Save.

Note: Using IronPython in SAP CPQ is limited as the system does not support standard IronPython modules. You cannot add external .NET and complex IronPython modules to SAP CPQ scripts. However, in basic user scenarios, you can paste the content of a simple module (without dependencies on other modules) into the SAP CPQ script module and the system will process it properly.

When an administrator is creating a new script and clicks on Attach to Event, SAP CPQ saves the new script. The administrator is not allowed to move to the Events tab unless the script name is properly defined. When creating a script, users can click Check Syntax to validate the script.
The screenshot below shows the interface when the script syntax is correct:

The following screenshots show the interface when a script contains errors:

You are here: CallidusCloud SAP CPQ Online HelpAdmin Page HelpScriptingScripting