The CreatorCon Call for Content is officially open! Get started here.

Can someone please post an example of a working ServiceNow URL that obtains sc_cat_item data using data from sc_req_item, like the RITM number?

Noob_who_needs_
Mega Contributor

1) I start by obtaining an SC Task number that I read from the task table.

2) I use that SC Task number to obtain the corresponding RITM number from the sc_task table.

3) I use the RITM number to obtain the sys_id (? maybe this isn't the correct field) from the sc_req_item table.

4) I am wanting to obtain sc_cat_item table data that corresponds to the RITM number so that I can see all the details and fields on the RITM.....would someone please post an example of a URL that does this when all I have is an RITM number?  

Thank you for any guidance you would provide.....

 

 

1 ACCEPTED SOLUTION

Noob_who_needs_
Mega Contributor

Hi Everyone - Here is the solution.  It took an architect in my company to know how to go after this custom field:

https://mycompany.service-now.com/api/now/table/sc_req_item?sysparm_query=number%3DRITM2365756&sysparm_display_value=true&sysparm_fields=variables.my_custom_field

 

The "&sysparm_fields=variables.my_custom_field" was apparently the key.  

 

Thank you very much to everyone who helped.  

 

View solution in original post

10 REPLIES 10

Allen Andreas
Administrator
Administrator

Hello,

Maybe it's best if you tell us the end-goal because you back-tracking way you're doing things may be unnecessary. You've tagged analytics and reports, but we don't know what you're doing.

So tell us what you're end goal is and then we can help you get there.

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hello,

I'm glad my reply was Helpful, which encouraged you to share more information...although you posted it in separate replies below, but, we can still see it.

It's still not clear where you're doing this...in a report, in a script, why a URL?

You're still not appropriately describing everything for us to help you.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Where I am doing this is in a utility called "REST API Explorer".  I enter parameters, and it generates a URL.  I am trying to step through the tables to see how the tables connect so that I can obtain all the pieces of data I ultimately need.  Using a script is not an option, not now, nor in subsequent steps of the build.  All I need is for the URLs to connect the data I need.  I have the URL working to get the SC task (task table), and I have the URL working that uses the SCTASK number from the task table to read the sc_task table to obtain the RITM number.  But now I need to take that RITM number and pull back the data from the RITM form....and there is only 1 field I need or care about - the custom field that I am told is on the sc_cat_item table.  I was thinking I %could use the RITM number that I got from the sc_task table to read the sc_req_item table, and then use the sys_id to read the sc_cat_item table, but that doesn't work.  Really stuck.

Mohith Devatte
Tera Sage
Tera Sage

Hello ,

if you want to see the corresponding catalog  item associated with that RITM number 

please refer to ITEM field on RITM form or list view where ITEM name will be tagged to it 

copy the name of the item and go to sc_cat_item table and search with that name and open the record.You can see the variables or fields created for that particular item

please accept this solution if it helped you 

thanks