Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.

[Solved] Find records with the same identifier that exist the same BO and update the other records

JHew

I have a business object where users will change the dates of a field using inline editing within a query. Some of these records will also have related records in the same BO, which will also needed to be updated if a user makes a change. Whist these are related, they still need to act as individual records 99% of the time therefore cant be set up as parent & child.

I have a rule in the business object that manages the first part, so if a user makes a change, and the record has related records (Main_Planning_Data.SubAssembly=0 ), it sets the value that all the related records need to be to field Main_Planning_Data.SubAssemblyDate.

If Main_Planning_Data.ProductionDate WAS CHANGED  AND Main_Planning_Data.SubAssembly=0 Then 
 Main_Planning_Data.SubAssemblyDate=Main_Planning_Data.ProductionDate-2

PlanSubAssemblies

Where I’m struggling, is understanding how to get the context correct so that the system knows to update the values of the related records. I’ve attempted this in the sub process (PlanSubAssemblies) that runs and have tried to use “This” to get the context right but it’s not working.

PlanSubAssemblies

FIND Main_Planning_Data WHERE  ThisMain_Planning_Data.SubAssemblyID=Main_Planning_Data.SALES_ORDER
IF SEARCH_COUNT > 0 Then Main_Planning_Data.ProductionDate = ThisMain_Planning_Data.SubAssemblyDate

Does anyone know where I’m going wrong?

Thanks.


hpl123

I find your description a bit difficult to understand but when it comes to the context question, here are some thoughts that might help.

If you have a particular MainObject instance and you need to find and update a list of related MainObjects instances with a value from that particular MainObject instance (from a business rule), a rule like this would do that:

FIND MainObject WHERE .....
OtherMainObject.Attribute=ThisMainObject.Attribute

What the "This" context prefix does in this situation is selects/uses the first of the MainObject instances in context (i.e the MainObject from which the rule was executed), the "Other" context prefix selects/uses all other MainObject instances.


JHew

Thanks, that worked perfectly. I wasnt even aware the "other" prefix existed!