Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Create a JavaScript array in a REST template

Create a JavaScript array in a REST template

These are instructions for creating JavaScript arrays using REST execution parameters.

About this task

To add more name-value pairs to the parameter's array, append the values to the existing array.

Procedure

  1. Create a JavaScript object with the following syntax, and add it to the executionParam.parameter array:
    var newParameter = {"name":"parameterName","value":"parameterValue","additional_attribute":"none"}; 
    executionParam.parameters.push(newParameter);

    By adding the new parameter JavaScript object to the array, you ensure that any elements already available in the array are not impacted.

  2. Make sure to set the value in the Additional attribute column in the REST message parameters input field to Do not escape text.

    In this case, the system does not escape the value specified for the value attribute. An example of this is:

    var newParameter = {"name":"parameterName","value":"parameterValue","additional_attribute":"do_not_escape_text"}; 
    executionParam.parameters.push(newParameter);
    Note: If the value for the additional_attribute field is None, then the system escapes the value specified by the value attribute. In the first example, parameterValue is escaped.

This site is scheduled for a small content update on Tuesday, December 18th, between the hours of 4:00pm and 8:00pm Pacific Time (Dec 19 00:00 – Dec 19 4:00 UTC). Access to this site may be slightly delayed during that time.