Before You Begin
This 10-minute tutorial shows you how to create a custom service request that includes a Groovy script to perform a calculation on the a customer’s credit limit and amount of unpaid orders to determine the percentage of a customer’s credit usage.
Background
You can create a service request that uses Groovy scripting to execute a custom process or to route data into another database. To use Groovy for a service request, the Orchestrator Studio provides an edit area that contains a sample Groovy script with instructions on how to modify the script.
Creating
the “Percent Usage” Service Request
- On the Orchestrator Studio Home page, click the Service Request icon.
- On the Service Requests page, click New Service Request, Custom.
- On the Custom design page, complete these fields:
- Service Request =
Percent Usage - Enter Short Description =
Groovy script to calculate the percentage of credit usage. - Click the Product Code drop-down list and select a customer product code, 55 - 59.
- Make sure that the Groovy option is selected and then copy the script from groovy_script.txt into the edit area.
- In the Input grid, add the following inputs:
Input Test Value CreditLimit 50000.0UnpaidAmount 45454.4 - In the Output grid, enter this output:
Output Variable Name UsagePercent UsagePercent - Save the service request.
- To test it, click the Test button.
- Close the test pop-up box and then close the Custom design page.
The Test Output value should show 90.9.
Creating
a Custom Service Request to Calculate Credit Usage