
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 09:46 PM
I have a catalog item that once submitted generates a number of sc tasks.
What I need to do is have a number of variables not only show, but also be mandatory on only one of the sc tasks that is created.
The tasks are all created at the same time.
there are a number of differences in each of the sc tasks that are created, the most obvious ones are the assignment group and the short descriptions, however using the catalog ui policy it's not possible to select those fields as a condition.
So ultimately what I want to do is on the particular sc_task, make catalog variables a, b, c, d visible and mandatory, however on all other tasks those variables don't show at all.
I have tried a number of things already without success such as:
how can I have different ui policies for different...
What is the Best Way to Make Catalog Task Variable...
Solved: How to make variable visible only on specified tas... (not using flow designer)
I would really appreciate some instructions if possible please rather than a link unless it is very specific and the same as what I'm trying to do.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 09:52 PM
Hi @Bidduam I think there is a onLoad client script on SCTask which hides the variable formatter if the variables are not emtpty. You can check client scripts on sc task table.
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 09:50 PM - edited 01-03-2024 09:52 PM
Hi @Bidduam You can a write a client script on SC Task table by checking short description of each task
Example:
var sd = g_form.getValue('short_description');
if(sd == 'test')
{
g_form.setVisible('variables.a', true); // your variablename must be like this variables.a , here a is variablename
g_form.setMandatory('variables.a',true);
g_form.setVisible('variables.b', true); // your variablename must be like this variables.b , here b is variablename
g_form.setMandatory('variables.b',true);
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 10:01 PM
Hi @Bidduam
If your conditions are very specific and based on certain fields in the table, you might consider having a client script at the table level.
Sample. (you can consider one more condition to check the Catalog Item as well)
function onLoad() {
if(g_form.getValue('short_description') === '<your_task_title>'){
g_form.setMandatory('variables.<your_variable_name>', true);
return;
}
g_form.setMandatory('variables.<your_variable_name>', false);
}
Cheers,
Tai Vu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 08:51 PM - edited 01-08-2024 08:53 PM
Thank you for your help both @Harish KM & @Tai Vu , you both came up with pretty much the same thing - really appreciate the help.
I have new issue that is related however:
When the sc_task variables are filled in and the sc_task is then saved the variables become hidden.
Here is an example of what is happening.
I have a catalog item that has variables on it, some are visible to the requestor via the catalog item, others are hidden and are then visible on the sc_task.
The example client script I've added as an onload is:
function onLoad() {
//Type appropriate comment here, and begin script below
var Shortdesc = g_form.getValue('short_description');
if (Shortdesc == "Please fulfill this order") {
g_form.setVisible('variables.question_a', true);
g_form.setVisible('variables.question_b', true);
g_form.setVisible('variables.question_c', true);
g_form.setMandatory('variables.question_a', true);
g_form.setMandatory('variables.question_b', true);
g_form.setMandatory('variables.question_c', true);
} else {
g_form.setReadOnly('variables.question_a', false);
g_form.setReadOnly('variables.question_b', false);
g_form.setReadOnly('variables.question_c', false);
g_form.setMandatory('variables.question_a', false);
g_form.setMandatory('variables.question_b', false);
g_form.setMandatory('variables.question_c', false);
}
}
Example catalog Item variables
Example catalog item - requestor
Example SC_Task before saving
Example SC_Task after saving
I've tried to write an on change client script (and a catalog client script) setup very much the same as the onload client script, with the opposite settings (as in trying to make the fields visible, but had no luck.
(I have that sort of thing disabled currently)
I've also tried to make the fields visible at the catalog item level, but then the fields I want only on the sc_task are shown to the requestor at the catalog item level.
Ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 09:52 PM
Hi @Bidduam I think there is a onLoad client script on SCTask which hides the variable formatter if the variables are not emtpty. You can check client scripts on sc task table.
Harish