Pushing cascade variables from the Order Guide to the Request form **SOLUTION**

mcorl
Tera Expert

I believe I have finally created a simple solution for populating the Request with cascaded variables from the Describe Needs page of the Order Guide. I searched for over a week and couldn't get a clear solution, but will try to make this as clear as possible. I'm assuming anyone looking for this solution has a basic knowledge of ServiceNow and already knows how to create a field on a form, a new Business Rule, etc.. We are currently running Calgary Patch 1, so I cannot say if the following instructions will work on earlier releases:

1) Pull up your Order Guide, right click the header and select 'Personalize Item'

2) Ensure the 'Cascade Variables' checkbox is checked (TRUE) on the Order Guide
- if it's not displaying on the Order Guide, you'll need to personalize the form to add it

3) Add a matching variable (NOT FIELD) on each item offered in the Order Guide
- if you have a variable on the Describe Needs page called 'u_employee_name', you need to add a variable to the items called 'u_employee_name'
- if you have a single item that will ALWAYS be included in the Order Guide bundle, you could get away with adding a variable only to that item
- the best way to ensure the variables match exactly is to create a Variable Set and add it to the Order Guide along with the items
- if they aren't already visible on the item form, you'll want to Personalize -> Related Lists and add 'Variable->Cat item' and 'Variable Sets'
**NOTE
This part was very confusing to me and I couldn't get a straight answer from my research. I added fields to the RITM form, the Item form, etc.. and it never work. FINALLY, I added a variable to the item itself (named the same as the Describe Needs variable on the Order Guide) and magic finally happened. I ultimately used a Variable Set which save a TON of time and ensures the variables match exactly between the Order Guide and Items.

4) Set the system property 'glide.sc.reset_cascade' to TRUE if you want the item's cascaded values to update if they change on the Describe Needs page

5) If desired, create UI Policies against the Catalog items to make the cascaded variables READ ONLY or Hidden altogether. (I hid our values on each item)
- once you have performed Steps 1-5, the matching variables should now cascade from the 'Describe Needs' page down to each bundled item

6) Create field(s) on the Request form that will hold the desired cascaded variables we'll retrieve from the attached Requested Items

7) Create fields on the Request form that will hold the desired variables, currently stored on the attached Requested Items.
- the names and labels of these fields are irrelevant and don't have to match the variable names as they did in previous steps

😎 Now we can create a Business Rule that will pull these values from the Requested Item(s) and place them on the actual Request form in our new fields

Name: Push RITM variables to Request form
Table: Request[sc_request]
When: AFTER INSERT
Script:


var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();

if (gr.next()) {
       current.u_name = gr.variables.new_hire_name;
       current.u_department = gr.variables.new_hire_dept;
       current.update();
}


9) This short piece of code is working perfectly and now we have the Name and Department of the new hire on our Request form and each requested item

Hopefully this guide will prevent the next person from spending the week of research I endured and expedite this process.
This is my first post, but please feel free to add improvements or suggestions to the content and I hope I was able to help!!

Best regards,
Mark
Lead ITSM Solution Architect
Sterling Jewelers
5 REPLIES 5

Justin Scheich
Tera Guru

Still useful ten years later in Tokyo. I was able to use this to pull the variables onto the request. Then running the workflow after from the same business rule I can now use those variables in my workflow.