How to show only incidents created by currently logged in user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 02:10 AM
Hi,
I am in a scenario to show only logged-in user-created incidents. I tried it, but it is not working. Kindly help.
if(current.sys_created_by == gs.getUserID()){
answer = true;
}
else{
false;
}
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 02:30 AM
Hi @Mark Manders,
Thank you for correcting my mistake. I checked that sys_created_by is a string field. I can simply use the condition, but I am not interested in using a condition. I want to use the script only.
if(current.opened_by == gs.getUserID()){
answer = true;
}
else{
false;
}
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 03:04 AM
Why would you script? It does exactly the same in the conditions and is even more efficient. Next to that: in the future anyone can easily see what is done, instead of having to open the script.
So you are not interested in using the best way to use the platform?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 03:37 AM
Hi @Mark Manders,
It is not that i don't want to use. I am practicing ACL script on my PDI.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 04:01 AM - edited 12-13-2024 04:02 AM
In your ACL - your are using incident . * (star)
* is ALL fields - not the table itself.
So change the "field" from * to "none" - then it evaluates for the table instead of all the fields.
Also - You dont want to use "current.opened_by" because thats a GlideElement
Use:
if(current.getValue('opened_by') == gs.getUserID()){
answer = true;
}
else{
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 04:20 AM
By the way - be careful if you test with your admin account as the ACL have "Admin override" meaning that it ALWAYS returns true 🙂 - effectively render the ACL true on all incidents
Else you need to remove the admin override checkbox