This extension point allows to trigger the groovy script in order to make one or all the following use cases.
- To prevent the configuration page to close
- This is controlled by the returned result of the groovy script. If the result obtained after executing the groovy was true, UI will allow closing the configurator page otherwise, the UI will stick to the configurator page.
- To perform the BOM Explosion based on the Lookup Table and conditions defined in the script
- Based on the custom conditions defined in the groovy script, the BOM Explosion can be performed via the groovy script.
- To replace the configured product with the matching classified products.
- The extension point will allow using the Pre Submit Check engine which provides methods to find the matching classified product(s) to replace the configurable product with the classified product if only one product is found and to display the found products information as notification.
Initial Setup
Upload the script file to the Groovy Script with the name “Groovy script to trigger when configuration page exits”. Please refer to Groovy Service Introduction - Uploading a New Groovy Script for more details of how to do this.
If the name,” Groovy script to trigger when configuration page exits” was not found in Master Data -> Groovy Script page, it is necessary to load the schema via the Operation Settings -> System Settings tab in order to bring that new groovy script extension point in new release.
Additional Binding Variables
The following binding variable(s) are made available for this extension point, in addition to the common binding variables listed in Groovy Service Introduction - Common Binding Variables.
Variable Name |
Class |
Description |
---|---|---|
currentSalesItemNode |
SalesItemNode |
Represents the sale item node of the configuration page that the user is about to leave. |
salesItemsTree |
SalesItemsTree |
Represents the Quote, it contains the functions that can be used to query the quote and its line items data as well as to modify them. |
preSubmitCheckEngine |
PreSubmitCheckEngine |
Represents a kind of engine that provide methods to find the replaceable classified products and replace the configurable product. The usage of the PreSubmitCheckEngine can be found in Sample Groovy Scripts - Configurable Product Replacement |
Expected Output
- The expected output after executing the script is a Boolean value (true or false). The protocol between UI and API response is that it will allow to close the configuration page if script execution returned true and not allow to close the configuration page if the script execution returned false.
- Returning true means that server allows UI to close the configuration. The conditions to decide if it should return true or false depends on the usage of the system. Some may define the condition to return true if all the mandatory attributes values are assigned or some may define the return value by looking via the lookup table data based on some data point inside the Quote.
- In addition to the expected output, user can also send the warning messages to UI. Especially for the use case of product replacement, script can be written to notify as a list of warning if more than one matching product are found for the configured products.
Script Execution
If user makes some changes on the Configurator page and then navigates out of that Configurator page, at that point of time the script will be executed. Below are some action examples when users exit the Configurator page:
- Clicking another tab within the same config item
- Clicking another line item or quote header
- Clicking the back button to go to the line items table
- Clicking on another menu item
- Reload quote page
- Clicking on Save the quote within the configurator
The above actions will trigger the triggerGroovyScriptOnConfigurationExits api to execute the groovy script. Depending on the response’s result value, UI will decide if it needs to keep the configurator page or not.
Comments
0 comments
Article is closed for comments.