Catalog Item with multiple variables need to be mandatory on second task

Community Alums
Not applicable

I have a catalog item with four variables that show on the catalog task. The item has a total of three catalog tasks.

Three of the variables need to be mandatory on the second catalog task. When I make them mandatory using the UI Policy, they are mandatory on the first task. Any suggestions on this?

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

Hi Shannon,

We use an onSubmit Catalog Client Script that Applies on Catalog Tasks.  In this case, we're only enforcing mandatory when the task State changes to Closed Complete.

function onSubmit() {
	if (g_form.getValue('state') == 3) { //Closed Complete
		if (g_form.getValue('short_description') == 'Task 2 Name') { //replace with your task short description
			g_form.setMandatory('v_imei', true);
			g_form.setMandatory('v_phone_number', true);
			g_form.setMandatory('v_scheduled_retirement_date', true);
			g_form.setMandatory('v_support_group', true);
			g_form.setMandatory('v_managed_by_group', true);
			
			if(g_form.getValue('v_imei') == ''){
				alert('IMEI is required');
				return false;
			}
			if(g_form.getValue('v_phone_number') == ''){
				alert('Phone number is required');
				return false;
			}
			if(g_form.getValue('v_scheduled_retirement_date') == ''){
				alert('Scheduled retirement date is required');
				return false;
			}
			if(g_form.getValue('v_support_group') == ''){
				alert('Support group is required');
				return false;
			}
			if(g_form.getValue('v_managed_by_group') == ''){
				alert('Managed by group is required');
				return false;
			}
		}
	} else {
		g_form.setMandatory('v_imei', false);
		g_form.setMandatory('v_phone_number', false);
		g_form.setMandatory('v_scheduled_retirement_date', false);
		g_form.setMandatory('v_support_group', false);
		g_form.setMandatory('v_managed_by_group', false);
		g_form.setMandatory('v_sim_id', false);
	}
}

 

Karthiga S
Kilo Sage

Hi @Community Alums 

 

Set the conditions to identify the second catalog task. You can use the "Order" field or any other unique identifier for the second task. Submit with any defined numeric value.

 

Add order is XXX as the filter condition to catch the Second task specifically and enforce changes via UI Policy/ Client Script.

 

Please mark it Correct and Hit Like if you find this helpful!

 

Regards,

Karthiga