Condition Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 03:41 AM - edited 09-15-2023 03:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 03:55 AM
I already replied to your earlier question but it seems you deleted that.
you can use script include and handle this
What did you try so far and what didn't work?
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-13-2023 03:59 AM
Hi @Ankur Bawiskar i just cant seem to add my condition to the condition field because it is long what is you suggestion? thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 04:03 AM
to make it short you can use hasRole with multiple roles passed at once
!ListProperties.isRelatedList() && !ListProperties.isRefList() && (ListProperties.getTable() != "sys_user" || ListProperties.getTable() != " u_user_account " || ListProperties.getTable() != " u_application_user_group" || ListProperties.getTable() != " u_m2m_appl_user_account_to_group " ||gs.hasRole("admin","user_admin","user_editor"))
To add further condition if it's not possible you can create a script include and add that condition there and call it
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-13-2023 04:09 AM
@Ankur Bawiskar should my script include be like this ?
var ListPropertiesCondition = Class.create();
ListPropertiesCondition.prototype = {
initialize: function () {},
isConditionMet: function (listProperties) {
return (
!listProperties.isRelatedList() &&
!listProperties.isRefList() &&
(listProperties.getTable() != "sys_user" ||
listProperties.getTable() != "u_user_account" ||
listProperties.getTable() != "u_application_user_group" ||
listProperties.getTable() != "u_m2m_appl_user_account_to_group" ||
gs.hasRole("admin") ||
gs.hasRole("user_admin") ||
gs.hasRole("user_editor"))
);
},
};