Business rule gliderecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 01:31 AM
Hi all,
I have business rule with simple glide record script.
if I entering the business rule via system administrator it will work fine.
but if I entered the business rule while impersonating another user that have ( itil , snc_internal and public_auction_admin) roles it well not enter the Glide Record.
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getSession().getUser().hasRole('public_auction_admin')) {
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.addEncodedQuery('stateNOT IN3,4,7');
gr.query();
while (gr.next()) {
gr.state = 2;
gr.update();
}
}
})(current, previous);
as I mentioned before, the business rule work only for administrator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 01:40 AM
Hi @eyal abu hamad ,
If the current user has the role 'public_auction_admin'. If the user has this role, the condition evaluates to true, and the code block within the if statement will be executed. If the user does not have the 'public_auction_admin' role, the code block will be skipped.
Also Check the acl on sc_task table and have read access to itil , snc_internal and public_auction_admin roles and also user have table level access to read or write .
Glide Record query, you are querying 'sc_task' records based on the 'request_item' field, so it's important to check the security settings on the 'request_item' field and its associated table to ensure that users with the roles
Please mark it as helpful and solution proposed if its serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 01:50 AM
I added all the roles and created also read and also write ACL record but still same thing