Parent and Child BO 'Was Changed' Rule

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
JHew
Posts: 27
Joined: Thu Jun 25, 2020 12:23 pm

Parent and Child BO 'Was Changed' Rule

Post by JHew »

I have made a parent BO and a child BO which both have a yes/no attribute called ‘Plan Slot’. I’m trying to make it so that If the user changes the Plan Slot value in the parent BO, it updates all instances of the child BO to the same value.

I’ve tried using the below but had no luck. Can anyone tell me where I’m going wrong?

Code: Select all

If OverhaulSlots_ParentDB.PlanSlots WAS CHANGED THEN OverhaulSlots_ChildDB.PlanSlot=OverhaulSlots_ParentDB.PlanSlots
joben
Posts: 221
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: Parent and Child BO 'Was Changed' Rule

Post by joben »

You could use a shortcut in this scenario.
If the attribute in the child BO should always reflect the value in the parent BO, a shortcut would be a more convenient solution.
If you cant use a shortcut for some reason, here is another answer to your question:

OverhaulSlots_ChildDB is not in the context.

Here is one way to do this:

Code: Select all

If OverhaulSlots_ParentDB.PlanSlots WAS CHANGED Then
FIND OverhaulSlots_ChildDB WHERE (OverhaulSlots_ChildDB.OverhaulSlots_ParentDB=OverhaulSlots_ParentDB)
OverhaulSlots_ChildDB.PlanSlot=OverhaulSlots_ParentDB.PlanSlots
Regards, Joakim

Image
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Parent and Child BO 'Was Changed' Rule

Post by PointsWell »

joben wrote: Mon Jan 31, 2022 1:17 pm

Code: Select all

If OverhaulSlots_ParentDB.PlanSlots WAS CHANGED Then
FIND OverhaulSlots_ChildDB WHERE (OverhaulSlots_ChildDB.OverhaulSlots_ParentDB=OverhaulSlots_ParentDB)
OverhaulSlots_ChildDB.PlanSlot=OverhaulSlots_ParentDB.PlanSlots
From memory FIND is not an available function for Business Rules, only Processes but you can use a BR to call a Process. The logic of this restriction is not clear
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Parent and Child BO 'Was Changed' Rule

Post by ACDC »

I’ve tried using the below but had no luck. Can anyone tell me where I’m going wrong?
Wouldn't this be a simpler approach:

Create a rule on the child object that simply says:

ChildObject.Attribute1=ChildObject.ParentObject.Attribute1 and make sure the "Dont check referred" on the rule is not checked

When the change occurs in the Parent object it should filter down to all the child objects automatically because of reference checking
JHew
Posts: 27
Joined: Thu Jun 25, 2020 12:23 pm

Re: Parent and Child BO 'Was Changed' Rule

Post by JHew »

Thanks All. Jobens Solution worked as required.
Post Reply