- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 09:37 AM
I have a client script below that should trigger on load of an incident and if the locked field is checked do some alerts. It seems to work just fine for admins but doesn't trigger at all for itil users. I saw a somewhat related problem that was tied to ACLs but other than the incident table I can't think where I might need an acl. Any suggestions are appreciated.
function onLoad() { alert('start') var ticket = g_form.getUniqueValue(); var incidents = new GlideRecord('incident'); alert('start query') incidents.addQuery('sys_id', ticket) incidents.query(); alert('run query') while (incidents.next()) { var user = g_user.getUserName(); if (incidents.u_lock_ticket) { if (user == incidents.u_locked_by) { alert('You have this ticket locked') } else if (g_user.hasRole('admin')) { alert('User ' + incidents.u_locked_by + ' has this ticket open'); } else { alert('User ' + incidents.u_locked_by + ' has this ticket open. Please confer with that user') action.setRedirectURL('home.do'); } }; }; };
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 11:07 AM
Hi James. Am I correctly understanding that an itil user doesn't even see the alert('start')?
I would try a few things:
- Is this client script view specific? You might need to make it global.
- Are you sure your itil user is viewing the same form/table as the admin user? You might need to mark it inherit.
- If you open your javascript console in your browser do you see any javascript errors?
- Is the client script just set on the incident form? If so, how is the itil user accessing that form?
-Will
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 11:07 AM
Hi James. Am I correctly understanding that an itil user doesn't even see the alert('start')?
I would try a few things:
- Is this client script view specific? You might need to make it global.
- Are you sure your itil user is viewing the same form/table as the admin user? You might need to mark it inherit.
- If you open your javascript console in your browser do you see any javascript errors?
- Is the client script just set on the incident form? If so, how is the itil user accessing that form?
-Will
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 12:28 PM
It seems to have been the inherit. After enabling that the itil user triggers the script when opening incidents. Thank you!