- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 03:51 PM
answer = getAttachmentReadAnswer();
function getAttachmentReadAnswer() {
var user=gs.getUserID();
gs.info("user name is:"+user); //in logs it is giving correct user
var grp=current.assignment_group;
gs.info("currentgrp name is"+grp); //in logs it is giving null
if(current.assigned_to == user)
return true;
else if(user.isMemberOf(current.assignment_group) {
return true;
}
else return false;
I want to provide access to seee the attachment attached on the case if the user opens a case and he belongs to assignment group of the case.
The above script is not working in ACL script .please help me on the ACL scriptong ony on how to check this one
Regards,
vijay
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 05:22 PM
try below
answer = getAttachmentReadAnswer();
function getAttachmentReadAnswer() {
var gr = new GlideRecord("task");
gr.get("sys_id", current.table_sys_id);
var user=gs.getUserID();
gs.info("user name is:"+user); //in logs it is giving correct user
var grp=gr.assignment_group;
gs.info("currentgrp name is"+grp); //in logs it is giving null
if(current.assigned_to == user){
return true;
}else if(gs.getUser().isMemberOf(gr.assignment_group)) {
return true;
}else{
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 05:07 PM
which table you have this acl on and try doing below
answer = getAttachmentReadAnswer();
function getAttachmentReadAnswer() {
var user=gs.getUserID();
gs.info("user name is:"+user); //in logs it is giving correct user
var grp=current.assignment_group;
gs.info("currentgrp name is"+grp); //in logs it is giving null
if(current.assigned_to == user){
return true;
}else if(gs.getUser().isMemberOf(current.assignment_group)) {
return true;
}else{
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 05:18 PM
Tablename:sys_attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 05:19 PM
running on :sn_hr_core_case table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 05:22 PM
You don't have any check for 'sn_hr_core_case table' table in your code, so this will run for attachments on all record types.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022