Creating a new script

The Automation Scripts application allows you to use Jython or Javascript to attach validation scripts to the Service Catalog at the attribute, offering, and cart levels.

Procedure

  1. Go to System Configuration > Platform Configuration > Automation Scripts.
  2. Click the Create Script action.
  3. Type a name for the script in the Script field.
    This field is required. You can also, optionally, enter a description.
  4. Specify a value for Script Language.
  5. Type or copy and paste your script code into the Source field.
    Note:

    For the validation scripts that have access to offering attributes, which are the fields on the dialog, there are two methods to get and save values.

    To retrieve the value of a attribute in the dialog, use the getValue method. For example, for an offering dialog that has an IPADDR attribute, you could use the following to populate the ipaddr variable with the value of the IPADDR field on the dialog:
    	ipaddr = offeringAttributes.getValue("IPADDR")
    To set the value on the dialog of an attribute, use the setNewValue method. The first parameter is the name of the attribute, and the second is the value to put in the field:
    offeringAttributes.setNewValue("DBDIR", "c:/ibm/db2")
  6. To test your script, click the Execute Script icon.
    The Script Results dialog is displayed.
    Note: Executing the script does not allow you to test the script working in the Service catalog environment, but it does allow you to catch any syntax errors in your script.
    Note: Jython determines blocks by indentation, and the execute script function will return a nonspecific "invalid decedent" message if it finds syntax or indentation errors.
  7. Click Close.
  8. Click the Change Status icon.
    The Change State dialog is displayed.
  9. Using the list next to the New Status field, change the status to Production.
    A script can only be used by Service Catalog if it is in the Production state.
  10. Click OK.
  11. To specify a version for your script, type a version number in the Version field.
    The Version field is optional.
  12. Click Save.