- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 01:59 AM
Hi All,
I have a requirement that "only the user who attached that attachment should be able to rename the attachment or delete/remove the attachment others shouldn't" for a particular table(custom table).
Thanks,
Bala
Solved! Go to Solution.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 02:28 AM
Hi,
you can try to use before update BR on sys_attachment and check if the logged in user is the created by of that sys_attachment
For Remove/Delete ensure you have correct table level DELETE ACL
Actually both your requirements can be handled via before update/delete business rule
BR: sys_attachment
Before Update AND Delete
Condition: current.table_name == 'incident'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(gs.getUserName() != current.sys_created_by){
gs.addErrorMessage("You are not allowed to update/delete the file as you are not the one who attached it");
current.setAbortAction(true);
}
})(current, previous);
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 04:20 AM
Hi,
create BR in your scope and test once.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader