DirkRedeker
Mega Sage

Hi

Did you ever want to see a list of Requested Items including their variables in a List?

Catalog Variables are NOT stored as separate fields on the Requested item [sc_req_item] table but are stored in a separate table [item_option_new]. You cannot add those variables/fields using "Personalize List Layout" or "Configure/List Layout". Instead, you need to take some steps in the underlying tables to configure what you want to see.

In Scripts, you can dot-walk to the variables of RITM records inside GlideRecord objects with "gr.variables.<varname>".
Similarly, you can add Catalog Variables to the List of Requested Items.

Below, you can see the few steps to perform, to replay this function.

 

 

The result you will get by following this article

The result after following the steps below can be seen in the screenshot below. The right-most column in the "Default view" of the "Requested Item" table holds the Catalog Variable "How do you feel".

If the Requested Item (underlying Catalog Item) is using and filling this Variable, you can directly see the content/value of the variable for the given Requested Item in the List, instead of opening each RITM one-by-one to review the values of the variable.  

find_real_file.png

Note:
because not all Catalog Items will utilize this Catalog Variable, a number of records will just show an empty field for that variable column. It may be a good idea to create separate Views for this use case and also filter on the RITMs, which leverages Catalog Items using that specific Catalog Variable.

 

 

Steps to reproduce

 

1) Create a Catalog Item with a variable.

In my example, I created a simple Catalog Item with just one Catalog Variable (see screenshot below).

find_real_file.png

 

 

2) Copy the SysID of the Catalog Variable to the Clipboard

Scroll down in the Form of the Catalog Item to the Related List of the Variables (1) and right-click the newly created Variable in the List (2) to select the menu entry "Copy sys_id" (3) - like shown in the screenshot below:

find_real_file.png

That copies the SysID, which we will need in one of the next steps.

 

 

3) Manually add a new Column to the List of the Requested Item table

Navigate to "> System UI > Lists" and filter for the "sc_re_item" table and the "View" for the "Default view" like shown in the screenshot below:

find_real_file.png

 Open the record marked yellow in the screenshot above.

find_real_file.png

Make sure, that you selected the List for the "Requested Item" [sc_req_item] table (1) and for the "Default view" (2). Furthermore, make sure, the fields "Parent" (3), "User" (4), and "Relationship" (5) are empty.

 

Then Click on "New" (6) to add a new column to the List View definition.

In the form that opens, type "variables." in the field "Element" and then insert the SysID from the Clipboard, that we copied in the previous step. The form should look something like shown in the screenshot below.

find_real_file.png

Note:
Your SysID to be used will certainly be NOT like shown in the screenshot above (like "61e4c...."). So, make sure, that you use YOUR SysID from the Variable.

Click on "Submit" to Save the new Element for the List.

Your List configuration should now look similar to what is shown in the screenshot below:

find_real_file.png

 

 

4) Create a RITM on the new Catalog Item

Navigate to your new Catalog item and click the "Try it" button to use the Catalog Item "at run-time".

Enter some text into the variable field (1) and click on "Order Now" to create the RITM.

find_real_file.png

 

 

5) Review the Catalog Variable Column in the List of the Requested Item table

Type "sc_req_item.list" in the Application Navigator and hit <ENTER> or navigate to the list of Requested Items using the Application Navigator modules.

Make sure, that you are in the "Default view" (1) and also make sure, that you did NOT personalize this view (which you can see if there is NO small dot attached to the gear icon on the left side header line.  

find_real_file.png

The new column for the Catalog Variable will be shown as the right-most column (2) in the List.

Records using that variable and having values for that variable will show their values directly in the List.

 

 

6) Review the List Layout

By clicking the gear icon to open the "Personalize List Columns" (1) popup, you can see the Variable column (2) added to the "Selected" fields in the slush bucket.

find_real_file.png

Note:
If you remove the Variable column ("How do you feel") from the "Selected" (2) List and Save the changes, you cannot return to the "Personalize List Columns" popup and add the column back to the list. The Column will not show up in the "Available" List (1) on the left side of the slush bucket.

find_real_file.png

To get the standard layout back, you need to click the "Reset to column defaults" (3) button, to bring the column back (which is pre-defined for the standard layout of the "Default View" List).

Note:
Furthermore, if you go to "Configure/List Layout" and remove the column from there, you need to start the steps from above to add the column back to the List View.

 

Wrap up

Adding Catalog Variables to Lists may become handy in different scenarios, but you should remember, that you create separate Views for this use case, so that the default views will not become "polluted" by these fields, which will not be filled for all RITM records.

 

 

Thank you for reading, and I hope you enjoyed this article.

Please provide your feedback on this article in the comments below.

If you like it, just mark this article as helpful and bookmark it using the "Bookmark" button above for later access.

Have fun and built something amazing on ServiceNow

Dirk

--------------------------------------------------------------------------------------------------------

If you like to also review my other articles on the ServiceNow Community, please have a look at the overview here:

Overview of my articles

NOTE: The content I provide here is based on my own experiences and does not necessarily represent my employer's views.

 

Comments
Gaurav66
Tera Contributor

Awesome article..!!

Mi Mi
Tera Contributor

Thank you. It is a very helpful article with clear explanation.

Seeker
Tera Explorer

Thank you ! Very well written and explained article ! This definitely needs more views 

mattystern
Kilo Sage

Dirk - Great article! Many use cases are, in my experience, are per-user request. Thus, I think these should not necessarily be built on the default view. Just my opinion here - steps will still work on a personalized view.

Nagendra Rao Si
Tera Contributor

Hi Dirk,

 

I followed your steps but my end these steps are not working.Is there any alternate please let me know

 

Thanks.

James Anton
Tera Contributor

thank you for the good article.

I have two questions for you.

1. Can I add items from MRVS to the list? mrvs depends on another table, is that possible?

2. sc_req_item and u_ritm_approval_line are connected. Can u_ritm_approval_line's data also be shown in the list?

 

please answer about my question.

Siddhi12
Tera Contributor

Hi 

I tried to bring in the catalog item variable on the list view of the My Groups Work list using the above steps listed. I'm getting the variable name but the value of that variable is populated only when we click on the list view .Can anyone help me with this. Please find the attachment below for the list view of how it is been visible.

Thank you in Advance!
NOW_Query.png 

bhavana10
Tera Contributor

The catalog variables which are included on the list view by following above steps are not visible to users without admin role.  Can anyone help me with this issue?

gregouaki
Tera Contributor

Great article

Thank you

ankitjambhale
Tera Contributor

I have try with sc_req_item table its working properly 

but when I try different table under scoped app its not working is their any alternative for this ??

 

Gary Ditsch
Tera Expert

Thank you for this article, which still providing value almost 3 years later, as it solved just the issue I was trying to solve.

GaneshSuresh
Giga Guru

This is helpful!

Epsylen
Tera Contributor

Thank you for that, it shows the variables in the requested item list. But how can I add the variables in related list for requested item inside of my request module. 

 

Like this......

Epsylen_1-1708900267829.png

 

But here...

Epsylen_0-1708900159763.png

 

Hayato
Tera Contributor

This is a great article, but there is a problem.
If you add more than 26 variables to the list, an error will be displayed.
It seems that there are no plans to fix this problem.
Reference URL: Report on variables on sc_req_item results in error like "Syntax Error or Access Rule Violation dete... 

Ruthika0319
Tera Contributor

This article helped me for showing the variable on the RITM table, but when I captured that in an update set and tried to move to other instance, it doesn't show up there.

Please correct me if I'm wrong.

 

Thank you.

Zmud1
Tera Contributor

Hello guys,

 

Can you confirm, whether this is going to work for a custom table in a scoped appication?

Version history
Last update:
‎05-26-2021 12:01 PM
Updated by: