Scripts

Scripts enables you to define scripts in product and specify events that will trigger the execution of those scripts. You may verify the execution of the script in Log on the user side.

To define your script, go to the Scripts tab in Products and click Add New (Figure 1).

Figure 1 - Scripts Tab

  • In the Rule Name field (Figure 2), describe the action executed by the script. For example, in our case we want the script to be executed on the event of adding an item to the quote.
  • The Description field enables you to describe the script in greater detail.
  • To activate the script in the system, tick the Active check box.
  • If you tick the Global checkbox the script will be added to the list of global scripts that can be attached to any product (global scripts are explained in greater detail further below).
  • Define your script in the Script field; SAP CPQ enables you to enter only the IronPython script engine type.
  • Click Check Syntax at the bottom of the page to ensure the script is valid. If valid, the system will return OK; if not valid, an error message will pop up and point out where you have made the error in the scripting code.
  • Click Attach to Event to specify the event that will trigger the execution of the script.

Figure 2 - Attaching Script to Event

You will be redirected to a page (Figure 3) where you will select the event that will trigger the execution of the script.

Figure 3 - Events Tab

To select a Global Script that will be attached to any product, and specify the event that will trigger the execution of that script, click Attach Global Script on the Scripts tab. You will be redirected to a page (Figure 4) where you will select the global script and specify your event.

Figure 4 - Execution Event

In our example the event was adding an item to quote with the script writing in the Log that the item has been added. Once you have clicked Add to Cart in the configurator, go to Log (Figure 5) to see if the script was executed. Once you have added the product to the quote, the Log Description field will be populated with an “Item Added” update.

Figure 5 - Log

You are here: SAP Sales Cloud CPQ Online HelpAdmin Page HelpProduct AdministrationProductsProduct EditorScripts