Hiding catalog item field

Avinash Dubey2
Tera Contributor

In the catalog item .I got a requirement to hide a field based on the user business unit and if it belongs to the list of business unit then assign it default value of yes.What approach should i should use Catalog client script or UI POlicy.

5 REPLIES 5

palanikumar
Mega Sage

You can do it using Catalog Client Script.  

Thank you,
Palani

srikar vinjamur
Tera Contributor

Hi Avinash

                             You can use catalog ui policy by giving the condition on when to Apply. when you click on submit open that policy and scroll down to create a new catalog ui policy action.

click on new and select visibility true.

 

BR,

V Srikar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So what did you start with and where are you stuck?

Regards
Ankur

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

Mahendra RC
Mega Sage

Hello Avinash,

If you have Business unit field on User record then you can create a UI policy:

Condition: (assuming the User is the name of variable on catalog item)

User.Business Unit.Name is one of [Your Business unit list]

Global: checked

Reverse if false: checked

On load: checked

On Script tab:

Run scripts: checked

UI Type: All

Execute if true:

g_form.setDisplay("field_name", true);
g_form.setValue("field_name", "yes");

Execute if false:

g_form.setValue("field_name", ""); // set value to no if you need as per requirement
g_form.setDisplay("field_name", false);

If my answer helped you in any way then please do mark it as helpful. If it answered your question then please mark it correct and helpful. This will help others with similar issue to find the correct answer.

Thanks