- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 02:46 PM
So I made a little REST script that will make a request into ServiceNow from a (mostly) publicly accessible web form.
Making the request is easy, and right after the request is generated, I immediately afterwards make a service catalog request that is tied to it. (all in the script) but when I view the service catalog request, it doesn't have variables that I can put the customer's data into.
Now, if I do this through the frontend (i.e. go to Self-Service >Requests, or Service Catalog > Requests), I'm prompted with adding the variables first for the catalog task, then a Request and a catalog task is made, along with the variables being shown in the catalog task.
When doing this from a REST Client, am I doing this out of order? Should I be making a sc_request first? But how do I populate the variables from the outside of SN? (through this script). I don't see where in the tables how the variables are connected to the service catalog items. (Or do I need to look at some other table?)
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 06:52 PM
Hi Alex,
Rather than copy paste a WHOLE lot of text in here, I'll point you to some posts I've made in other discussions with regards to the variable relationships.
- First, please look here for an explanation of how the relations are laid out between the variable definitions, stored values, and the tasks they belong to:
Re: Copying RITM variables into Catalog Item variables - Then there was also a short discussion here on using REST in a way similar to what (it sounds like) you are trying to do:
Re: Fetching "Variables" values in REST API
So, first you will need to understand the relationship between tables... Then you can go about populating the needed values via your REST calls. Depending on what platform you're using, you could probably combine the whole operation into one scripted REST call that populates all the info, instead of calling to each table.
Give the above a read, and then let us know what questions you have left to make it work.
Thanks,
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 06:52 PM
Hi Alex,
Rather than copy paste a WHOLE lot of text in here, I'll point you to some posts I've made in other discussions with regards to the variable relationships.
- First, please look here for an explanation of how the relations are laid out between the variable definitions, stored values, and the tasks they belong to:
Re: Copying RITM variables into Catalog Item variables - Then there was also a short discussion here on using REST in a way similar to what (it sounds like) you are trying to do:
Re: Fetching "Variables" values in REST API
So, first you will need to understand the relationship between tables... Then you can go about populating the needed values via your REST calls. Depending on what platform you're using, you could probably combine the whole operation into one scripted REST call that populates all the info, instead of calling to each table.
Give the above a read, and then let us know what questions you have left to make it work.
Thanks,
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 08:40 AM
Thanks, I'll give it a read, and come back if I have any other question or concern. If I figure it out, I'll post my solution here as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2017 09:01 AM
Hey Brian,
Sorry for the lull in my response, a few things came up that resulted in this getting put on the backburner.
So a few more details. I'm doing this with a Perl Rest script, and when you mentioned that this could possibly be in one REST call, what I want to do is:
From a public webform, outside of SN, user punches in description of issue/request, contact info, and etc.
In ServiceNow, an RITM with the General Request type from the service catalog is created, linked to a request, and possibly a catalog task.
So in a very abstract nutshell, it looks like I need to query General Request's variables defs, store the answers in sc_item_option and if I do make a catalog task, add it to: sc_item_variables_task.
I don't think I'll need to touch the cart table, since this is all being doing through APIs and stuff, and not through the front end? Or am I misunderstanding what the cart table is?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 07:34 AM
So we ended up going with a different solution when the stakeholders in the project decided they wanted to use different record types for the application.
Thanks for your help though.