Hide/Unhide variable on particular catalog task

Kiran Patil3
Giga Expert

Hi

Trying to solve below scenario.

How can we hide one particular variable in one of the catalog task in workflow but should be visible on next task.

E.g. RITM request is submitted and Task 1 is active. Variable 'A' which should be visible on Task 1 and once Task 1 is completed, workflow will generate second catalog task Task 2. Variable 'A' should not be visible on Task 2.

What are the options here, please suggest.

Note: We have tried UI policies and Catalog client script (which does not support event for specific catalog task) and also we dont want to add UI action on catalog task table for specific service. Looking for some generic approach.

Thank You

11 REPLIES 11

But Ui Policy applies for Catalog item right? not on catalog task.

I can see applies for catalog item or variable set.

Can you help me on this?

 

Thanks

It can be applied only on task as well. Also For each of the activities, you can select which variables to show in workflow and flow designer as well. But make sure variables are set to global false

Bargavi
Mega Expert

Yes.. you can use the slush bucket on catalog task form in Workflow just like @purbalipc said.

 

You can use UI policies to mark them Mandatory, which works only on catalog tasks - by checking "Applies on Catalog Tasks"

 

find_real_file.png

 Thanks!

Vladi1
Kilo Guru

I assume that you would like this variable to be visible on catalog task level only, not on RITM. 

There are two options. 

Option 1 create variable on RITM level

Create variable on RITM level and define its visibility as Bargavi described in his post. You can set up to apply on Catalog item views and Requested item views. Add fields under UI action and set Read only and mandatory as Leave alone, while visibility is set to False. 

You will need client script (we use onSubmit because this fields are required on closing). One of the conditions is catalog task short description (not best practice, probably sys_id could be used)

function onSubmit() {
//Type appropriate comment here, and begin script below
var state = g_form.getValue('state');

if(((g_form.getValue('state')==3) || (g_form.getValue('state')==4) || (g_form.getValue('state')==7)) && ((g_form.getValue('short_description') == ('catalog task short description')) && (g_form.getValue('v_test') == ('')))){

g_form.setMandatory('v_test',true);
return false;
}
}

in the workflow add this variable to selected variables on catalog task where you want to make it visible (task A in your case)

 

Option 2 create variable on Catalog task level. This approach creates variable on the workflow and it is visible on the RITM form if you do not setup any UI Policy

Go to workflow/edit workflow variables and add new variable. Create variable and add to your task A, but not task B

You will also need onSubmit script if you want it to be mandatory on closing catalog task

function onSubmit() {
//Type appropriate comment here, and begin script below
var state = g_form.getValue('state');
if((g_form.getValue('state')==3) && g_form.getValue('test') == ('') && (g_form.getValue('short_description') == ('test short description'))){
g_form.setMandatory('test',true);
//g_form.setMandatory('Workflow:test',true);
return false;
}
}

 

by using short description field in script condition you can apply this rule on any task regardless on its order in the workflow; i.e., task B instead of Task A in your case. 

Vijayalakshmi M
Giga Contributor

Hi Kiran,

Is there any solution found for the same your query,as i'm also facing the same issue.Please suggest if there are any it will be helpful.

 

Thank you