Differences

This shows you the differences between two versions of the page.

adminhelp:develop:creating_a_script [2019/03/05 07:52]
mnikolic created
adminhelp:develop:creating_a_script [2019/03/05 07:54] (current)
mnikolic
Line 1: Line 1:
 ====== Creating a Script ====== ====== Creating a Script ======
 +A script contains a series of commands that can be executed without being compiled. 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. 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 CPQ is limited as the system does not support standard IronPython modules. You cannot add external .NET and complex IronPython modules to CPQ scripts. However, in basic user scenarios, you can paste the content of a simple module (without dependencies on other modules) into the CPQ script module and the system will process it properly.\\
 +\\
 +When an administrator is creating a new script and clicks on **Attach to Event**, 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:\\
 +{{:adminhelp:develop:syntaxisok.png?600}}\\
 +The following screenshots shows the interface when a script contains errors:\\
 +{{:adminhelp:develop:syntaxnotok.png?600}}\\
 +== Forbidden .NET Classes and Namespaces ==
 +The following .NET namespaces and classes are forbidden in IronPython scripts:
 +  * **System.IO**
 +  * **System.Data**
 +  * **System.Configuration**
 +  * **Webcom.Configurator.Util.ConnectionStringProvider**
 +  * **System.Environment**
 +  * **System.GC**
 +These namespaces and classes were available before the 1902 release, so administrators may had used them in client scripts. In such cases, errors will display after the 1902 release when administrators save those scripts.\\
 +\\
 +If there are scripts that contain //System import *// and //Webcom.Configurator.Util import *// and any of the words from the forbidden classes, the system disables saving scripts (for example, saving is disabled if there is //System import *// and //Data// in the same script).\\
 +\\
 +For troubleshooting, please contact the SAP CPQ Support team.
  
You are here: SAP CPQ Online HelpAdmin Page HelpScriptingCreating a Script