Remove Catalog Variable from Request Item, but not the Catalog Task

galvi024
Kilo Explorer

We have created a Request Catalog item and a corresponding workflow that has three Catalog Tasks. This workflow also has a reference type Workflow Variable that is required for Tasks 2 & 3. So when I created the variable, I checked the "Mandatory" box to force task 2 & 3 to require this field. However, I notice that the variable shows up on the Request Item as well...before the workflow ever gets to task 1, 2, or 3. Which means that users cannot update the request item (comments for example) unless they first update my variable.

Is there a way to remove this required field from the Request Item, but not the Catalog Task?

Thanks,
Mike

2 REPLIES 2

TJW2
Mega Guru

Write a UI Policy that shows the Variable AND makes it Mandatory. Check the 'Applies to Catalog Task' checkbox.
OR you can write an 'onLoad' client script that makes the variable Mandatory on the specific tasks. You will need a unique name or something to Identify the tasks.
onLoad{
if (g_form.getValue('short_description') == 'Task2'){
g_form.setMandatory('current.variable.xxxxxx',true); // where xxxxxx is your variable name
}


jeff_lord
Giga Contributor

You can also create a Client Script for the sc_task table that is an onload script (or whichever works best for your instance) and have it set those fields as mandatory. In this you would have to reference the sys_id so it would go to the correct request item
Here is an example of an onChange one

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}

//If the catalog item is General Epic Report Request make sure the variables are not mandatory
if(newValue!=3){
var req_item = g_form.getReference('request_item');
if(req_item.cat_item == 'xxxxxxxxxxxxxxxxxxxxx'){
g_form.setMandatory('variables.xxxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxx',false);
g_form.setMandatory('variables.xxxxxxxxxxxxxxxx',false);
}
}
//If the catalog item is General Epic Report Request make the variables mandatory
if(newValue==3){
var req_item = g_form.getReference('request_item');
if(req_item.cat_item == 'xxxxxxxxxxx'){
g_form.setMandatory('variables.xxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxxxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxxxx',true);
g_form.setMandatory('variables.xxxxxxxxxxxx',true);
}
}

}