Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Catalog Item Visibility Based on Dynamic Role Pattern (x_*) Without User Criteria

YerragondaA3099
Tera Contributor

Hi Community,

I have a requirement where a specific Catalog Item should be visible only to:

  • Users with the itil role, or
  • Users who have any role that starts with x_

Normally, I would implement this using User Criteria, but in our instance the system property glide.sc.use_user_criteria is disabled due to other business requirements, so User Criteria is not an option.

There are over 200 roles that begin with x_

What would be the best approach to achieve this requirement for a single Catalog Item?

Thanks

@Ankur Bawiskar @Dr Atul G- LNG @Allen Andreas @Hardit Singh 
1 REPLY 1

Ankur Bawiskar
Tera Patron

@YerragondaA3099 

then you can use onLoad catalog client script + GlideAjax

the script include would validate if logged in user has itil role or has any role starts with x_

if not then it shows an alert to user and directly takes user to portal homepage

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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