- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2016 01:58 PM
Is there an easy way to override a Reference Qualifier on a Catalog Variable?
We are using the code below to filter the reference field, but need an admin override and would rather not edit script include.
nameNOT LIKEServiceNow^ javascript: groupMembershipSelectGroupRefQual(gs.getUserID(), current.variables.name, current.variables.altname == 'add')
-Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2016 07:35 AM
Hello Cullen,
You could move the rest of the condition into the JavaScript as a string in that case:
javascript: if(!gs.hasRole('admin')) {'nameNOT LIKEServiceNow^' + groupMembershipSelectGroupRefQual(gs.getUserID(), current.variables.name, current.variables.altname == 'add')}
Please mark helpful and/or correct if you find my response as such.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2016 03:42 PM
You could put an if statement in your condition like this:
if(!gs.hasRole('admin')) { // Current user does not have Admin role
// Your function here
}
nameNOT LIKEServiceNow^ javascript: if(!gs.hasRole('admin')) {groupMembershipSelectGroupRefQual(gs.getUserID(), current.variables.name, current.variables.altname == 'add')}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2016 07:17 AM
Thanks Robert,
That works fine for the script include, but I also need the condition to be included in the override.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2016 07:35 AM
Hello Cullen,
You could move the rest of the condition into the JavaScript as a string in that case:
javascript: if(!gs.hasRole('admin')) {'nameNOT LIKEServiceNow^' + groupMembershipSelectGroupRefQual(gs.getUserID(), current.variables.name, current.variables.altname == 'add')}
Please mark helpful and/or correct if you find my response as such.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2016 08:14 AM
I tried moving it around within the script earlier with no success, but that appears to have worked.
Thanks again Robert!