Business Rule to update Location Fields based on its Parent Record.

Shree14
Tera Contributor

Hi,

 

I am trying to write a "After-Business Rule" on Location[cmn_location] table, to update the Location Default Stockroom based on its Parent's Stockroom.

 

Encoded Query should be >> if(u_status=Active^u_bar_codeSTARTSWITHH^ORu_bar_codeSTARTSWITHS^u_default_stockroomISEMPTY^parent.u_default_stockroom.u_active=true){

current.u_default_stockroom = current.parent.u_default_stockroom 

}

 

I am using the below logic, but it's not working as expected. so please let me know how can we Achieve this Requirement.

 

Shree14_0-1682606116191.png

 

Shree14_1-1682606190415.png

 

Thanks,

Shree

 

1 ACCEPTED SOLUTION

Ankit Rawat
Giga Guru

Hi @Shree14 ,

 

Use Before Business Rule.

 

Regards,

Ankit

View solution in original post

3 REPLIES 3

Ankit Rawat
Giga Guru

Hi @Shree14 ,

 

Use Before Business Rule.

 

Regards,

Ankit

Thanks @Ankit Rawat.

 

That worked! But, I wonder why it won't work for "After".

It is not recommended to update same Table with After Business Rule. For after business rule you have to  write script and query same record and update.

 

After Business rule is useful for updating another table record based on the current table record insert or update. 

 

Please Mark My solution helpful and Accept my solution.

 

Regards,

Ankit