- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 10:24 AM
I'm new to ServiceNow and assisting automation process. I can access catalog task information using SC_Task API end point but seems like Variables are store somewhere else. If I have a TASK000001 and need to retrieve value assigned to variable "X". How can I do that? Is there a table that links to Variables -> Values?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 06:48 PM
Hi,
It works in the REST API Explorer, you just have to use:
variables.field_name
Example of setup (you can use sc_task table as well, as mentioned above):
And on RITM itself:
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 10:56 AM
Hi,
You can query the sc_req_item (Requested Items) table or sc_task table, using the sys_id field value from the task record to then get the variables such as:
variables.variable_name
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 01:39 PM
Allen, this works via Angular JS / Widget scripting but from API. there is no field that returns for variables from sc_req_item table API end point. Is it possible that I need to query a different table when I'm accessing via API.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 06:48 PM
Hi,
It works in the REST API Explorer, you just have to use:
variables.field_name
Example of setup (you can use sc_task table as well, as mentioned above):
And on RITM itself:
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 08:48 PM
approach mentioned by Allen will work.
Please use sc_task table instead of sc_req_item
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader