Pass Order Guide Variables to Catalog Task Without Showing in in each Catalog item in Order Guide

jwagner
Tera Contributor

I've created a new hire order guide with the several variables I'd like to share across all included catalog items. 

Common info I'd like to have on all catalog tasks: Supervisor/First Name/Last Name/Shift/Title/Department/EmployeeID 

Catalog items: Build Computer/ Setup Phone/ Setup Email/ Create Access

There is no need for the user to see all those fields listed on each catalog item within the order guide, but I want to pass the variables to help the fulfiller.

 

 

 

 

 

 

and the following set of informaktion I'd like to carry over to each catalog item, but 

1 ACCEPTED SOLUTION

Brent Sutton
Mega Sage

Hi Ya,

Create the common variables in a variable set and include the variable set on the order guide and all catalog items that can be selected in the order guide. In the variable set you need to create an onload client script with UI Type set to "All" so it runs on both platform and Service Portal. Should look something like this:

function onLoad() {
	
	if (window === null) {
		// check if we are in an order guide using the g_service_catalog api for Service Portal and Mobile
		var isOrderGuide = g_service_catalog.isOrderGuide();
		
		if (isOrderGuide) {
			//call function to hide the fields on the catalog items if this is an order guide.
			hideVariables();
		}
	}
	else {
		var item = gel("current_item");
		var guide = gel("sysparm_guide");

		if (item != null && guide != null && item.value != guide.value) {
			hideVariables();
		}
	}
	
	function hideVariables(){
		g_form.setDisplay('your_var1',false);
		g_form.setMandatory('your_var2',false);
		g_form.setDisplay('your_var2',false);
	}
}

On the order guide tick "Cascade variables" option which will copy the value of the data captured in the order guide down to the Service Catalogue items

find_real_file.png

That should now hide the variables, when displayed within an order guide. More information can be found about cascading variables at the following link - Cascade an order guide variable

Let me know how you get along.

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

View solution in original post

12 REPLIES 12

venkatesh6
Kilo Explorer

Hi All,

 

I am still facing this issue in Service Portal side.  

 

If i am selecting variable at describe needs , it is not visible as the selected value to the catalog items. So, the user is getting confused whether the value is selected or not.

 

If you can see the below screenshots - I selected New hire at the order guide initial page, but it is not displaying at the items section.

It is visible only at the last catalog item variable section. 

 

Can you please help me onthis, as i am facing this issue since somany days.

find_real_file.png

 

 

 

find_real_file.png

 

Attaching you the script written for Variable set:

find_real_file.png

 

Hi Ya, Change the order of your setMandatory and setDisplay statements in the hideVariables function. Variables must not be mandatory when hiding them.

g_form.setMandatory('employee_status',false);
g_form.setDisplay('employee_status',false);

Let me know how you get along.

Brent

PS0166
Kilo Contributor