/* Settings of Automation Director service input parameters(*) */
var requestParams = {};
requestParams["VolumeLabel"] = recordAccessor.getVariable("VolumeLabel"); //
String type parameter setting example
requestParams["StorageSystem"] = JSON.stringify({“storageDeviceId”:
recordAccessor.getVariable("StorageDeviceId")}); //File type parameter
setting example
/*~~~~~~~~~~~~~~~~~*/
/* (Set as much as required) */
/*~~~~~~~~~~~~~~~~~*/
workflow.info(JSON.stringify(requestParams, null, 2));
workflow.scratchpad.requestParameters = JSON.stringify(requestParams);
In
requestParams
, the required Automation Director parameter Key and Value are set. You can also
specify the service run schedule as a task setting. For details on the built-in service parameters and task
settings, refer to "Submitting a service" in the
HPE XP7 Automation Director REST API User and
Reference Guide
.
After running the Automation Director service and obtaining the result, you can implement post-
processing according to the use case, such as updating the ticket as is shown in the sample workflow.
Output from Invoke Automation Service sub-workflow
The output of the Invoke Automation Service sub-workflow (workflow.scratchpad.hadresult) includes the
following:
•
status
: Completed, Failed, or Canceled.
•
data
: JSON format data of the Automation Director service output property values obtained by using
the Automation Director "Getting a list of property values" REST API.
•
message
: Error message (only when an error occurs).
You can easily obtain the Automation Director service output property values provided in JSON format to
use with a method defined in the AutomationClientLibrary. The sample code is as follows:
var result = workflow.scratchpad.hadresult;
allocatedVolume = AutomationClientLibrary.findPropertyByValue (result.data,
'keyName', 'LUNPathConfigurationInformation').value; // Pick up value from
JSON data by specifying property keyName
workflow.info("Details of added volumes: " +
JSON.stringify(allocatedVolume,null,2));
current["work_notes"] = JSON.stringify(allocatedVolume, null, 2);
Running the workflow
When running the ServiceNow workflow, enter the required items in the service catalog item request form
and send the request.
Refer to
in the ServiceNow product documentation for more information.
Running the workflow
85