The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Catalog UI Policy

davidsmith
Tera Expert

Hello,

I am setting up  new Catalog Item that allows users to request software to be checked by Infosec staff so that they can check on privacy settings and so on. I have some varibales/questions that are visible to the user and some that need to be on visible to the Infosec member of staff. How do I acheive this via a Catalog UI Policy?

 

David

13 REPLIES 13

Nikhil Bajaj9
Tera Sage

Hi @davidsmith ,

 

Since you need to pick the users and based on users/Roels you want to show/hide varaibles so this can be achieved throguh Catalog Client script. Utilize methods from Glide user class and write your client script.

 

If my answer helped you, please makr it- solution accepted. 

 

Regards,

Nikhil Bajaj

 

Please appreciate my efforts, help and support extended to you by clicking on – ā€œAccept as Solutionā€; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

Ankur Bawiskar
Tera Patron
Tera Patron

@davidsmith 

since you want some variables to be shown/hidden based on group membership.

Please use onLoad catalog client script + GlideAjax

what did you start with and where are you stuck?

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

@davidsmith 

Thank you for marking my response as helpful.

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

kaushal_snow
Mega Sage

Hi @davidsmith ,

 

>> Create a Catalog UI Policy....

 

Set the Condition to check for the user's role:

g_user.hasRole('infosec_role')

Define the actions you want to apply, such as setting the variable to mandatory or read-only...

 

** You can also use a Catalog Client Script for Dynamic Visibility **

 

Use the following script to check the user's roles and adjust variable visibility accordingly:

function onLoad() {
// Check if the user has the 'infosec_role'
if (g_user.hasRole('infosec_role')) {
// Show the variable for Infosec staff
g_form.setDisplay('variable_name', true);
} else {
// Hide the variable for end users
g_form.setDisplay('variable_name', false);
}
}

 

If you found my response helpful, please mark it as ā€˜Accept as Solution’ and ā€˜Helpful’. This helps other community members find the right answer more easily and supports the community...

 

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

@kaushal_snow 

Could you please help sharing the screenshots on how the role check condition can be applied in UI policy conditions field? It would be helpful for other members as well.

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