This script helps with auto-completion of the Quote. The groovy script can be used to automatically add products, set the product’s configurations, set various quote attributes, and any other supported operations, all based on complex logic and conditions specific to the business requirements. And since it is a script, it can be adapted and changed more quickly as those requirements change.
As any auto-completion logic that may be required is necessarily a customer specific one, there is no standard implementation of it.
Initial Setup
Upload the script file to the Groovy Script with the name “Organize Line Item Structure”. Please refer to Groovy Service Introduction - Uploading a New Groovy Script for more details of how to do this.
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 |
---|---|---|
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. |
activeObject |
String |
The URI of the active object (which is the quote URI in this case). |
Expected Output
The script should return the salesItemsTree variable at the end, after performing the required modifications to it.
Script Execution
For this extension point, the script must be manually triggered by the user, as follows:
- Click the “Organize line items with script” button in the Line Items tab of the Quote screen.
- The list of all scripts with type “Organize Line Item Structure” will be displayed in a pop-up window. Select the script that you want to execute and click the “Next” button.
- A preview of the resulting quote structure will be displayed after the script has been executed successfully. At this stage, the actual structure of the quote has not been changed yet. If the result is not as expected, you can click the “Close” button to abort.
- Otherwise, click on the “Accept” button to apply the result to the quote. The system will then perform the actual modifications to the quote structure and data to follow the result of the script. Note, validation checks by the system were not applied when generating the preview in the previous step, thus the process can still fail at this stage.
The structure and data may also be modified further by other subsystems at this stage, so the end result may not be exactly the same as what the preview showed. For example, if the script added a new item, and that item has a BOM explosion trigger, the preview will not include the items from the BOM explosion, but the end result would.
- Save the quote to persist the changes. Note that if you navigate away from the quote before saving, the changes may still be discarded.