Business rule - Write a global BR for a scoped application

Anish Reghu
Kilo Sage
Kilo Sage

What is the impact of writing a business rule with Application set as Global on a table which is defined in a scoped application? Please cite an example to help understand the reply better.

 

Regards,

Anish

3 REPLIES 3

Anish Reghu
Kilo Sage
Kilo Sage

Did I get it right - If I say the Business rule executes only when the users have the application set to the scoped one?

Let's assume a before update BR exists.

User A has scope set to Global, user B has scope set to <scope_name>.

Both users update the table.

Is the following the output?

User A does not see the business rule executing any actions while updating.

User B does see the actions executed via the BR.

 

Cheers,

Anish

Just add this as a condition on the Business Rule, where sys_id_of_application is the sys_id of the application scope that the user must be in for the script to run. This would go in the Condition field above the Script field. The Advanced checkbox needs to be checked to see these fields.

gs.getCurrentApplicationId() == sys_id_of_application;

Anshu_Anand_
Kilo Sage
Kilo Sage

Hi,

 

You need to add condition to your BR

The method is

gs.getCurrentApplicationId()

 

This returns the 'sys_id' of the current application the user is in.

Use this sys_id to GlideRecord into 'sys_apps' and you'll get the name of the app.

If this condition matches, BR executes else not.

so user logged in and try to do CRUD operation on that table, it checks the scope as per condition and executes BR else not.

 

Hope this is helpful. If yes then please mark this answer as correct.

 

Regards,
Anshu