Restriction on Editing/Renaming HR Case Attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
As an HR Agent, we need to restrict requestors from editing or renaming attachments that have been added by an HR Agent or other users.
Requestors should be able to edit or rename attachments that they have uploaded themselves. However, they should not be able to edit or rename attachments uploaded by agents/other members
This restriction should apply only to HR Cases in the ESC portal.
Any guidance on the best approach to implement this would be greatly appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago - last edited 4 hours ago
Hello @smiley4
It is first important to understand where this pencil / edit icon/button is being coded:
Make a right click on this pencil icon and click Inspect (browser: Chrome) and then you will find out below highlighted code is responsible:
If you make a right click on this highlighted code, then you can cut it and you will notice the pencil icon is gone just for you and just for this session like if you refresh the webpage then it will be back again.
You can copy the button name "attachment.canWrite" and then navigate to All > Service Portal > Widgets (personalize the list to show Body HTML template column) or Apply the filter Body HTML template contains attachment.canWrite
You will find out that it is defined in Out of the box SC Order Guide widget.
So, this is the widget which maybe used by multiple portals within your organization which you need to identify then clone this widget so that everyone starts using the clone and you need to modify the widget to hide this button based upon your condition/scenario.
So, the above may or may not be a viable solution.
The other option is Access Control List (ACL):
Post Elevate roles under your profile, Navigate to All > System Security > Access Control (ACL) and then click New and Create a new ACL as shown below (please update the table name):
if (current.table_name == 'sc_req_item') { //update the table name
var attaddedBy = new GlideRecord('sys_user');
if (attaddedBy.get('user_name', current.sys_created_by)) {
answer = (attaddedBy.sys_id == gs.getUserID());
} else {
answer = false;
}
} else {
answer = true;
}
Validation Results:
Hope that helps!
