Oracle by Example brandingCreating a Custom Service Request to Calculate Credit Usage

section 0Before 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.


section 1Creating the “Percent Usage” Service Request

  1. On the Orchestrator Studio Home page, click the Service Request icon.
  2. On the Service Requests page, click New Service Request, Custom.
  3. On the Custom design page, complete these fields:
    • Service Request = Percent Usage
    • Enter Short Description = Groovy script to calculate the percentage of credit usage.
  4. Click the Product Code drop-down list and select a customer product code, 55 - 59.
  5. Make sure that the Groovy option is selected and then copy the script from groovy_script.txt into the edit area.
  6. In the Input grid, add the following inputs:
    Input Test Value
    CreditLimit 50000.0
    UnpaidAmount 45454.4
  7. In the Output grid, enter this output:
    Output Variable Name
    UsagePercent UsagePercent
  8. Save the service request.
  9. To test it, click the Test button.
  10. The Test Output value should show 90.9.

  11. Close the test pop-up box and then close the Custom design page.