After Insert Business Rule not firing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2018 02:11 PM
I am trying to get an After Insert business rule to fire on the "sys_user_has_role" table.
I have bigger plans in the future, but for the time being, I just want to see a log statement when a user gets a role. The problem is the BR isn't firing when the user gets the role from being added to a group. However, when I add a role to the user directly, it works fine. See below for script:
(function executeRule(current, previous /*null when async*/) {
gs.warn("BR Triggered");
})(current, previous);
As I said before, if i add the role to the user directly, it works fine. If, however, I add the user to a group, and they get the role from being added to the group, it doesn't fire.
Help?
@ctomasi any ideas?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2018 02:58 PM
I think you would have already done this, but just to confirm, do you have the insert flag checked in the BR? And no condition in the BR.
Below script inserts the role and I don't see a statement which wouldn't run the BR.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 04:13 AM
Hey sanjiv, Yeah, it's got the flags turned on. That's the perplexing part. If you add the role to the user directly it works fine, it's when you add them to a group and depend on OOB business rules to add them to the group that it fails.
@ctomasi any advice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 04:36 AM
Hi
Hope I have understood your question correctly
The table that is mentioned , I mean the business rule is written on sys_user_has_role table, But if you see the screen shot image the role table is not the same that you have written the business rule and the table name is "sys_group_has_role"
Its very clear the business rule is written on sys_user_has_role" table and you are adding group then the roles are inherited from the "sys_group_has_role" table
That is the reason the log statement works when you add the role directly and It doesnt work when you add the role inherted from the group table
Please mark helpful / Correct , If your query is resolved
Rajesh Kumar Annepaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 05:33 AM
Not sure this is the case, since even when I add the user to a group, and they get the role via inheritance, a record is inserted in the "sys_user_has_role" table. It should still work.