After Insert Business Rule not firing

Community Alums
Not applicable

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?

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

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.

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

Community Alums
Not applicable

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?

Rajesh Annepak1
Kilo Guru

Hi 

 

Hope I have understood your question correctly 

find_real_file.png

 

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

 

 

Community Alums
Not applicable

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.