Restrict Incidents for Service Account
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 02:50 AM
Hi,
I have a service account that creates Incidents. Now they want to also Resolve incidents for which I would need to give them Write access on the Incident table. But, also I want to restrict the Service account only to access the Incidents created by them and not beyond that.
How can I achieve this?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 02:54 AM
Hi @Jake Adams ,
I trust you are doing great.
You can add the below code in the write ACL , it will resolve your usecase
(function executeRule(current, previous /*null when async*/) {
// Replace 'your_service_account' with the actual service account user ID
var serviceAccount = 'your_service_account';
// Check if the current user is the service account and if they are the creator of the incident
return gs.getUserID() === serviceAccount && current.opened_by == gs.getUserID();
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi