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

Update changed “Requested for” variable value on RITM with using “Reference” variable type

Eeshamayee kon1
Tera Expert

Introduction

 

In ServiceNow, managing and updating variables on a Requested Item (RITM) can be essential for ensuring accurate request handling. One common challenge is changing the auto-populated "Requested For" variable value while submitting the request. However, the updated value may not reflect on the RITM as expected. In this article, we will explore a solution to address this issue by leveraging the "Reference" variable type.

Note: While you can achieve this requirement by directly using the "requestor for" variable type, there are scenarios where using the "Reference" variable type becomes necessary. For example, if you restrict the visibility of a catalog item to specific groups, using "requestor for" as the variable type may result in errors. In such cases, you should consider using the "Reference" type.

 

 Screenshot 2023-10-04 at 8.48.15 PM.png

 

Problem Statement

 

The problem involves modifying the auto populated "Requested For" variable value during request submission and ensuring that the RITM record reflects this change accurately.

 

Solution Overview

 

To solve this challenge, we need to understand the underlying data structure in ServiceNow. Three main tables play a crucial role in mapping catalog variables to requested items:

1) Variable Ownership [sc_item_option_mtom]: This table contains two primary fields:

  • Parent Item: Stores the RITM number in the reference field from the Requested Items [sc_req_item] table.
  • Dependent Item: Stores the sys_id in the reference field from the Options [sc_item_option] table

2) Options [sc_item_option]: This table stores variables and the values entered by users. By mapping this table with the Variable Ownership table using the "Dependent Item" field, we gain access to all user-entered values for specific questions.

 

3) Requested Item [sc_req_item]: This table is familiar and will be used to map with the "Parent Item" field from the Variable Ownership table. This mapping allows access to all fields in the Requested Item table.

 

Solution Steps

 

To implement the solution and update the "Requested For" variable value on RITM, follow these steps:

Step 1: Create a sub-flow and within the sub-flow, perform the following actions:

   

   Action 1: Lookup RITM record

   Eeshamayeekon1_0-1696434637503.png   Action 2: Retrieve the variable ownership records related to the identified RITM.

 

Eeshamayeekon1_1-1696434762612.png

 

   Action 3: For each variable ownership record(sc_item_option_mtom) related to the RITM, proceed with the following actions:

 

Eeshamayeekon1_2-1696434872014.png

 

   Action 4: For getting the variable value, lookup the Options records(sc_item_options) related to Variable ownership dependent value.

 

Eeshamayeekon1_3-1696434978375.png

 

   Action 5: Check if the question pertains to the Requested for and has a value.

 

Eeshamayeekon1_4-1696435008704.png

 

   Action 6: If the question is related to the requestor and has a value, update the RITM record with the "Requested on Behalf Of" information.

   

Eeshamayeekon1_5-1696435040931.png

 

Step 2: Create a flow for the catalog item. In the first action of this flow, invoke the previously created sub-flow.

 

By following these steps, you can effectively update the "Requested For" variable value on the RITM using the "Reference" variable type.

 

Thank you.

5 REPLIES 5

Najmuddin Mohd
Mega Sage

Helpful. Thank you!

SAI SRIKANTH AL
Tera Contributor

Good one!

saichary
Tera Contributor

Helpful

Rekha N
Tera Contributor

Thanks for sharing the information.Helpful👍