Catalog SCTASK

Bheemaraju Vagu
Tera Expert

Hi Community Family😍

Trying to solve below scenario.

How can I hide one particular variable in one of the catalog task but should not 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, flow will generate second catalog task Task 2. Variable 'A' should not be visible on Task 2. And should be visible on TASK3.

What are the options here, please suggest.

Note: I have tried UI policy where I can handle only one Task but visibility for another I can't handle. Looking for some generic approach.

Thank You

2 ACCEPTED SOLUTIONS

@Bheemaraju Vagu 

you said in your question you don't want to show it in Task 2 then why to add that variable in Flow Designer create catalog task action?

You want to show in Task 3 then add it there

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Hi @Bheemaraju Vagu 

If the Email field is displaying in all the catalog tasks, let's double-check the Global checkbox in the Email variable.

 

"Is there any client script is available ? like that email field should be available only for a  particular assignment group then the issue would resolve."

I'm not sure your use case is to apply this On Load only or On Change the assignment group field.

If it just need to execute On Load, you can refer to the below approach.

1. Create On Load Catalog Client Script.

2. Check the checkbox Applies on Catalog Tasks.

3. Do the validation on the assignment group and set display accordingly.

Sample below.

function onLoad() {
	if(g_form.getValue('assignment_group') !== '<the_sys_id_of_group>'){ //replace your assignment group sys_id
		g_form.setDisplay('email', false); //replace your variable name
	}
}

 

The script above is hard-coding. If you don't want to do that, you can define a system property and do an AJAX call to do the validation.

 

Cheers,

Tai Vu

View solution in original post

14 REPLIES 14

Tai Vu
Kilo Patron
Kilo Patron

Hi @Bheemaraju Vagu 

We can define an UI Policy or Client Script, which will check the checkbox Apply on Catalog Tasks.

Then check if that is the Task 2 (your conditions to identify Task 2), and set the variable invisible.

Sample below (OnLoad Client Script (Applies on Catalog Tasks))

function onLoad() {
	if(g_form.getValue('short_description') === '<your_task_title>'){ //or repalce your own conditions
		g_form.setDisplay('<your_variable_name>', false);
	}
}

 

Cheers,

Tai Vu

@Tai Vu 

Task title means?

There is only Assignment group, the requirement is for particular assignment group only the Email field should visible rest not visible.

 

Could you tell me how to do that?

 

Hi @Bheemaraju Vagu 

It's the short description of the Catalog Task. You can set with your own conditions, then make the variable visible and invisible accordingly.

Or just simply follow the approach that Ankur's mentioned. Remove that variable from the second catalog task.

In your flow designer, come to the second catalog task. Move the Email variable to the left-hand side.

Sample below.

TaiVu_0-1699871252506.png

 

 

Cheers,

Tai Vu

@Tai Vu 

I did the same but not working.

That email field is coming in all the tasks. 

 

Is there any client script is available ? like

That email field should be available only for a  particular assignment group then the issue would resolve.