- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 03:58 AM
Hello everyone,
I have a simple before BR on the 'sys_audit_role' table. The BR is in my scoped app.
I have removed all conditions from the BR and set it to trigger on Insert or Update.
When I remove/add someone's role, the sys_audit_role table inserts a record to show the activity; My issue is that, once this record is inserted into this table, my BR does not trigger. Here is my BR:
(function executeRule(current, previous /*null when async*/) {
gs.info('CRIS Count Role ran'); // This never shows in logs, BR does not run
var licPurchased;
var licAllocated;
var licRemaining;
var operation = current.getValue('operation');
var gr = new GlideRecord('x_arl_licence');
gr.addQuery('company', current.user.company);
gr.query();
if(gr.next()){
licPurchased = gr.licences_purchased; // Check how many they purchased
licAllocated = gr.licences_allocated; // Check how many they have used
if(operation === 'Added'){
licAllocated += 1; // Update allocated licences, add one
}
if(operation === 'Removed'){
licAllocated -= 1; // Update allocated licences, subtract one
}
gr.licences_allocated = licAllocated; // Update allocated licences with new count
gr.update();
}
})(current, previous);
The above gs.info does not show in the logs, so the BR is not running.
The BR is:
- Active
- Has no trigger conditions other than Insert/Update on the table
- My app has a cross-scope privilege recod for the table, for operation 'Read', status 'Allowed'
- The table I am trying to trigger the BR on is 'Accessible from all scopes' and 'Can read' is true
- Ideally, this will be an 'After' business rule, but I have also tried 'Before' BR with same issue
Any ideas why I cannot get this to trigger?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:40 AM
Yeah I have created the property and tested the records getting created now. But the BR is not getting triggered so assuming OOTB code might using .setWorkflow(false).
For your usecase, do you see any challenges to create BR on sys_user_has_role table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:19 AM
What is also interesting, if I manually insert a record into that table (With the 'New' List Control button), the BR triggers fine.
It is only when the system is inserting the record, the BR does not trigger

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:23 AM
Alright I just triggered one from my end in my PDI when I assign role to user I don't see a record got created or updated in sys_audit_role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:29 AM
There is a plugin 'glide.role_management.v2.audit_roles' to enable that functionality.
Once enabled, that table will populate every time you remove/add a role.
The BR triggers fine if you manually insert, but when the audit logic is inserting it, the BR does not trigger

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:40 AM
Yeah I have created the property and tested the records getting created now. But the BR is not getting triggered so assuming OOTB code might using .setWorkflow(false).
For your usecase, do you see any challenges to create BR on sys_user_has_role table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 05:53 AM
Thanks Vamsi, I think you are correct; they are probably using setWorkflow(false)... sys_user_has_role will probably be the next option. I will modify my logic to use that table instead.
Many thanks for your help!