Creating Service catalog request by using a json file.

NeethuB
Tera Contributor

Hi , I am trying to create a service catalog request in ServiceNow using a json file. I can create a request in service catalog by using the json file created by the ServiceNow by using the network tab in chrome. But i got a json file which is created in diffrent API, that json file contain different attributes with different and new field. So if i have to create a service Catalog by using json file how can i do it ? Do I have to create a variable set for the service catalog request  form? 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@NeethuB You would need to write a script include (a server side script) to process the response received from the third party API. You can use JSON.parse() method to convert JSON string to an object in Javascript and use dot walking to access different properties/attributes. For more information on JSON parsing please refer to https://www.servicenow.com/community/developer-blog/json-parsing/ba-p/2279166

 

After JSON parsing, you can create the request via script with the help of CartJS API. please refer to https://www.servicenow.com/community/itsm-articles/creating-a-service-request-using-service-catalog-... to know how you can create request via script. 

 

Hope this helps.

View solution in original post

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@NeethuB You would need to write a script include (a server side script) to process the response received from the third party API. You can use JSON.parse() method to convert JSON string to an object in Javascript and use dot walking to access different properties/attributes. For more information on JSON parsing please refer to https://www.servicenow.com/community/developer-blog/json-parsing/ba-p/2279166

 

After JSON parsing, you can create the request via script with the help of CartJS API. please refer to https://www.servicenow.com/community/itsm-articles/creating-a-service-request-using-service-catalog-... to know how you can create request via script. 

 

Hope this helps.