Business Rule

Abhishek Kr47
Tera Contributor

My Use case  is:

To create a relation b/w business application and CI and after creation the work notes should get updated and this relation is stored in cmdb_rel_ci table.

Similarly, we have to delete the relation also, and the work notes of parent( Business App) should get update.

 

So, In business rule, which business rule should be used to update the Work notes ?

 

Before or After ??

 

Doubt: If we use After, parent table sys_id will get deleted.

             And if we use Before, while doing Code Run Review (update set), it gives that it might have Data Integrity Issues  

  

1 REPLY 1

Marcos Kassak
Kilo Sage
Kilo Sage

Hi @Abhishek Kr47,

 

Opting for a "Before" business rule might prevent data integrity issues during the Code Run Review (update set) process as it checks before the action occurs. However, it might not be suitable for updating work notes since the relationship change hasn't yet taken place, and the work notes might not accurately reflect the action that is about to occur.

 

Considering this, a recommended approach could involve using an "After" business rule to update the work notes. To avoid the risk of the parent table sys_id being deleted, you might need to structure the business rule logic to exclude scenarios where the deletion might impact the parent table.

 

For example, within the "After" business rule logic, you could verify if the parent table sys_id exists or perform conditional checks before updating work notes to ensure it remains intact even after the relationship deletion.