- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 12:06 AM
i created one Read only ACL for one table and i written below script but it's not working so please let me know my mistake
answer=true;
var ciLink=current.u_ci_link;
var gr= new GlideRecord("u_cmdb_ci_service_vmware_insta");
gr.addQuery('name',ciLink);
gr.query();
if(gr.next()){
var grd=new GlideRecord('u_alm_service');
if (grd.get(gr.u_itaas_asset_number))
answer =grd.getDisplayValue('assigned_to')==gs.getUserID();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 12:38 AM - edited ‎02-19-2024 02:10 AM
Hi @mani55 ,
Can you try using Access Analyzer to assess your ACL if you are working on Vancouver
Please mark helpful/correct if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 12:11 AM
Hi @mani55 ,
Try something like below
answer=false;
var ciLink=current.u_ci_link;
var gr= new GlideRecord("u_cmdb_ci_service_vmware_insta");
gr.addQuery('name',ciLink);
gr.query();
if(gr.next()){
var grd=new GlideRecord('u_alm_service');
if (grd.get(gr.u_itaas_asset_number)){
if(grd.assigned_to == gs.getUserID()){
answer = true;
}
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 01:36 AM
the ACL is working for me but when i am impernate with others and i'll doing testing on that time it's not working '
answer=true;
var ciLink=current.u_ci_link;
var gr= new GlideRecord("u_cmdb_ci_service_vmware_insta");
gr.addQuery('name',ciLink);
gr.query();
if(gr.next()){
var grd=new GlideRecord('u_alm_service');
if (grd.get(gr.u_itaas_asset_number)){
answer =grd.getValue('assigned_to')==gs.getUserID();
}
}
gs.log('hello i am value of answer'+answer);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 12:17 AM
Hi @mani55 ,
In the below line you are comparing the display value of assigned to with sys_id of current user. So it will never be the same.
answer =grd.getDisplayValue('assigned_to')==gs.getUserID();
Instead use below code -
answer =grd.getValue('assigned_to')==gs.getUserID();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 12:17 AM
Hi @mani55 ,
Can you add gs.addInfoMessage to see what is it returning?
answer=true;
var ciLink=current.u_ci_link;
var gr= new GlideRecord("u_cmdb_ci_service_vmware_insta");
gr.addQuery('name',ciLink);
gr.query();
if(gr.next()){
var grd=new GlideRecord('u_alm_service');
if (grd.get(gr.u_itaas_asset_number))
answer =grd.getDisplayValue('assigned_to')==gs.getUserID();
}
// infoMessage
gs.addInfoMessage('hello i am value of answer'+answer);
If it returns false, only then user will have access . since it returns true in the begining you will anyway get access to edit the record.
Alternatively, how @Danish Bhairag2 suggested is the better way to do it.
Warm Regards,
Shivambi