Create Child Record from rule in Parent

Contains tips for configurators working with Aware IM
Post Reply
Ewanm
Posts: 111
Joined: Mon Jun 04, 2007 11:09 am
Location: Scotland

Create Child Record from rule in Parent

Post by Ewanm »

I am trying to create a child record from a rule which runs in the parent record. When the parent is updated, It appears that a new record is created in the child BO with all the data in it that is required but is not referenced to the parent and does not display in the parent.

Any help would be great.

Thanks
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Create Child Record from rule in Parent

Post by tford »

Post the rule you are using & perhaps we can help troubleshoot.
Tom - V8.8 build 3137 - MySql / PostGres
Ewanm
Posts: 111
Joined: Mon Jun 04, 2007 11:09 am
Location: Scotland

Re: Create Child Record from rule in Parent

Post by Ewanm »

Thanks for the reply, I am using the rule below

If IMS_Detail.EngName WAS CHANGED Then CREATE IMS_Assignments WITH IMS_Assignments.Eng_Name=IMS_Detail.EngName,IMS_Assignments.DateAssigned=IMS_Detail.DateAssigned,IMS_Assignments.TimeAssigned=IMS_Detail.TimeAssigned


Thanks
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Create Child Record from rule in Parent

Post by tford »

WITH IMS_Assignments.Eng_Name=IMS_Detail.EngName
This part is correct, so it should be creating the child instance correctly.

Code: Select all

.. but is not referenced to the parent and does not display in the parent
What makes you conclude that the child is not referenced to the parent?
Tom - V8.8 build 3137 - MySql / PostGres
Ewanm
Posts: 111
Joined: Mon Jun 04, 2007 11:09 am
Location: Scotland

Re: Create Child Record from rule in Parent

Post by Ewanm »

When I look at the contents of BO IMS_Assignments, there are records being created but when I put IMS_Assignments as an attribute in the IMS_Details form, nothing is displayed, just a header.

I have the attribute set to Multiple Allowed and a Peer relationship.

When I look at Presentation, I have the three Attributes selected to display.

Thanks.
pureist
Posts: 427
Joined: Sun Jan 24, 2016 10:00 pm

Re: Create Child Record from rule in Parent

Post by pureist »

This topic probably shouldn't be in 'Tips and Tricks' (probably should be in 'General'), but anyway..

the below will not add the new IMS_Assignments instance to the Reference Attribute (for IMS_Assignments) in IMS_Detail. Maybe you are thinking in terms of non-Aware convention of parent-child association. It will only create an instance of IMS_Assignments.

You need to add another Action after it, "INSERT IMS_Assignments IN IMS_Detail.IMS_Assignments_reference_attribute _name"
(only option if IMS_Assignments does not have an IMS_Detail Reference Attribute)

OR, if IMS_Assignments does have an IMS_Detail Reference Attribute, then alternatively, don't add another Action after it, but instead insert after the 'WITH':

IMS_Assignments.IMS_Detail_reference_attribute_name = IMS_Detail,
Ewanm wrote:Thanks for the reply, I am using the rule below
If IMS_Detail.EngName WAS CHANGED Then CREATE IMS_Assignments WITH IMS_Assignments.Eng_Name=IMS_Detail.EngName,IMS_Assignments.DateAssigned=IMS_Detail.DateAssigned,IMS_Assignments.TimeAssigned=IMS_Detail.TimeAssigned
Thanks
Last edited by pureist on Sat Oct 01, 2016 6:44 am, edited 1 time in total.
Ewanm
Posts: 111
Joined: Mon Jun 04, 2007 11:09 am
Location: Scotland

Re: Create Child Record from rule in Parent

Post by Ewanm »

Thanks for the reply,

That worked, I thought Aware did all that automatically but see it now.

Thanks Again.
pureist
Posts: 427
Joined: Sun Jan 24, 2016 10:00 pm

Re: Create Child Record from rule in Parent

Post by pureist »

It can't. IMS_Assignments might be Peer to several Objects.
And besides, you might want to have instances of IMS_Assignments which are created unpeered, as you were doing.
Ewanm
Posts: 111
Joined: Mon Jun 04, 2007 11:09 am
Location: Scotland

Re: Create Child Record from rule in Parent

Post by Ewanm »

Thanks Again
Post Reply