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

I don't have a view of the form - that is a different department, different team, and I don't have access.  All I have is this "Rest API explorer" tool that I can use to help me build URLs.  I can't query the tables other than via this means.

Here is all the data I get back from reading the sc_req_item table.  I cannot find any information here that I can use to join with the sc_cat_item table to obtain the value in the custom field on that table.  And here is the URL I am useing to query the sc_req_item table:

 

URL I use to read the sc_req_item table:

https://mycompany.service-now.com/api/now/table/sc_req_item?sysparm_query=number%3DRITM2365756&syspa...

 

 

Results of the above URL read of the sc_req_item table: Which of these fields connects to the sc_cat_item table?  sys_id doesn't work.  Neither does task_effec tive_number.  And I have tried reading for the date time stamp.  Nothing.  No results.

{

 

  "result": [

 

    {

 

      "u_count_of_attachment": "",

 

      "watch_list": "",

 

      "sc_catalog": "",

 

      "upon_reject": "Cancel all future Tasks",

 

      "requested_for": {

 

        "display_value": "System Administrator",

 

        "link": https://mycompany.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441

 

      },

 

      "sys_updated_on": "06/18/2022 04:15:04",

 

      "approval_history": "",

 

      "skills": "",

 

      "number": "17d5f30b1b445d945807fccbde4bcbba",

 

      "price": "$0.00",

 

      "recurring_frequency": null,

 

      "state": "To Be Approved",

 

      "sys_created_by": "admin",

 

      "knowledge": "false",

 

      "order": "",

 

      "cmdb_ci": "",

 

      "active": "true",

 

      "work_notes_list": "",

 

      "sys_domain_path": "/",

 

      "u_level_three": "",

 

      "business_duration": "",

 

      "group_list": "",

 

      "u_alternate_contact_name": "",

 

      "u_alternate_contact_phone": "",

 

      "approval_set": "",

 

      "wf_activity": "",

 

      "order_guide": "",

 

      "u_multiple_recipients": "",

 

      "short_description": "",

 

      "correlation_display": "",

 

      "work_start": "",

 

      "additional_assignee_list": "",

 

      "u_undefined_ci_name": "",

 

      "service_offering": "",

 

      "sys_class_name": "Requested Item",

 

      "closed_by": "",

 

      "follow_up": "",

 

      "reassignment_count": "0",

 

      "assigned_to": "",

 

      "sla_due": "UNKNOWN",

 

      "u_recipient": "",

 

      "comments_and_work_notes": "",

 

      "cat_item": "",

 

      "stage": "waiting_for_approval",

 

      "escalation": "Normal",

 

      "upon_approval": "Proceed to Next Task",

 

      "correlation_id": "",

 

      "estimated_delivery": "",

 

      "u_requestor_summary": "",

 

     "u_machine_name": "",

 

      "made_sla": "true",

 

      "u_task_visible_to": "",

 

      "sn_esign_document": "",

 

      "task_effective_number": "17d5f30b1b445d945807fccbde4bcbba",

 

      "sys_updated_by": "admin",

 

      "opened_by": {

 

        "display_value": "System Administrator",

 

        "link": https://mycompany.service-now.com/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441

 

      },

 

      "user_input": "",

 

      "sys_created_on": "06/18/2022 04:15:04",

 

      "sys_domain": {

 

        "display_value": "global",

 

        "link": https://mycompany.service-now.com/api/now/table/sys_user_group/global

 

      },

 

      "route_reason": "",

 

      "u_reference_4": "",

 

      "u_reference_5": "",

 

      "u_reference_2": "",

 

      "closed_at": "",

 

      "u_reference_3": "",

 

      "u_reference_1": "",

 

      "backordered": "false",

 

      "business_service": "",

 

      "time_worked": "",

 

      "u_closed_comments": "",

 

      "u_reference_6": "",

 

      "expected_start": "",

 

      "opened_at": "06/18/2022 04:15:04",

 

      "configuration_item": "",

 

      "u_alternate_contact_email": "",

 

      "work_end": "",

 

      "work_notes": "",

 

      "request": "",

 

      "assignment_group": "",

 

      "u_reference_1_ritm": null,

 

      "u_segment_group": {

 

        "display_value": "Corporate Segment Group",

 

        "link": https://mycompany.service-now.com/api/now/table/sys_user_group/3af3620e4f3b46005f97efd18110c7c9

 

      },

 

      "description": "",

 

      "calendar_duration": "",

 

      "close_notes": "",

 

      "sys_id": "602e0313db085d50a6960f4dca9619ad",

 

      "contact_type": "",

 

      "sn_esign_esignature_configuration": "",

 

      "u_level_two": "",

 

      "company": "",

 

      "activity_due": "UNKNOWN",

 

      "comments": "",

 

      "quantity": "1",

 

      "approval": "Not Yet Requested",

 

      "due_date": "",

 

      "sys_mod_count": "0",

 

      "recurring_price": "$0.00",

 

      "billable": "false",

 

      "u_level_one": "",

 

      "u_requested_date": "",

 

      "u_email_log": "",

 

      "location": ""

 

    }

 

  ]

 

}

 

 

 

Noob_who_needs_
Mega Contributor

Thank you everyone.

My end-goal is to obtain a particular variable value that is held in a custom field on an RITM.  My ServiceNow form designer person is telling me that this custom field is held on the sc_cat_item table.  

I am also being told that I should obtain the task number first, then use that task number to retrieve the RITM number.  These I have working correctly.

But I am stuck where I use the RITM number (or data from the sc_req_item table) to read the sc_cat_item table so that I can find this custom field and the value in it.  I have tried reading the sc_cat_item table usuing sys_id - but that doesn't work.  And there doesn't seem to be an RITM number field on the sc_cat_item table.  

Hey ,

If you want to access a variable value for an existing RITM follow the below path 

Go to sc_item_option_mtom.LIST table ---> and copy the sys_id of the RITM in the dependent field or column and filter the records -- >find the record with question as your variable name-->open the record and see the value stored in it

please accept the solution if it helped you 

thanks

How do I go to the .LIST table using the% REST API Explorer?

"Go to sc_item_option_mtom.LIST table ---> "

All it lets me do is choose table sc_item_option_mtom.....does ".LIST" have a parameter name/type that I can perhaps filter on?

Noob_who_needs_
Mega Contributor

and not to add confusion, but the BIG BIG picture - big end goal is to also update the status of both the RITM and the SC Task to being assigned to someone AND status of "work in progress", and finally to close the requests once the automated process finishes.

I am struggling to find documentation or help anywhere for this, which is why, after a many-months-long-saga, I am breaking down and posting here.   If anyone can help...please volunteer information.  I think this shouldn't be this hard, this difficult.  I think what I am trying to do is very basic, but there are no samples anywhere.