Hiding catalog item field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 11:45 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 11:47 PM
You can do it using Catalog Client Script.
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 12:20 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 12:33 AM
Hi,
So what did you start with and where are you stuck?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 09:06 AM
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