How do I get the value of a variable for an Order Guide?

larsbowassini
Kilo Expert

I have an Order Guide that contains several variables (v1, v2, v3, v4, v5)

When this is set, a Rule creates a Catalog Item. The same Catalog Item for every variable, so it is possible to request 5 Items which is (almost) the sames

I have created an onLoad on the item:

function onLoad() {

  var guide = $("sysparm_guide");    

  if (!guide) {

  return;

      }

  var orderGuide = new GlideRecord('sc_cat_item');

  orderGuide.get(guide.value);

  if (orderGuide.variables.v1) //<- This is undefined!

}

1 ACCEPTED SOLUTION

Apparently this is not possible in ServiceNow! I have got the variables cascading to the item, but it is not possible to get ServiceNow to create 5 similar items via an Order Guide!


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

What exactly are you trying to do here, could you give more context? Also, there are a couple of issues with the way you're trying to access that variable, the first being that you can't use that syntax in a client script and the second being that it can only be accessed from the created record. You might try cascading the variable values from the order guide to the catalog item.



Service Catalog Order Guides - ServiceNow Wiki


Hi Brad,


I have 5 systems to where people can request access. All the systems are the same kind, so requesting access requires the same information of all systems, but the users may only want access to one specific system. All systems are managed by different administrators.


My solution is that I have created one catalog item, where the system is in the first variable. I would like to use the order guide to let the user select each system and have the system automatically set the 1st variable - thus creating 1-5 Request Item, where the user can enter relevant information for each system. Then a workflow creates the needed tasks to the different administrators.



I have made the Check boxes on the Order Guide cascade. Also I didn't wanted to complicate my explanation with Ajax code - apparently it is advance enough as it is 😉


Apparently this is not possible in ServiceNow! I have got the variables cascading to the item, but it is not possible to get ServiceNow to create 5 similar items via an Order Guide!