Problem with Saving Child Records


Author
Message
Geoff Hirst
Geoff Hirst
StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)StrataFrame User (221 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Guys,

I have been chasing this most of the day and although some success I am really puzzled by what I have going on now.

I am using the automated listview tools, and as such have a parentBO, childBO and childformdialog . I have read many previous posts and removed my childautofilter that was causing some issues.

I am passing both my parent and child BO's through to the childform using translations that are configured on the childformdialog. However, in my childform I have overriden the onload event, as described in a another post, to set the parentbusinessobject of my childBO as for some reason it doesn't come over from the parentform.

If I add a new parent record, then go on to add a number of childrecords, save each child, then return to the parent and save the parent, my understanding is that the child records should recieve the parents ID upon the parent saving, is this correct? What I have happening is that the first child record I entered, does not get the parents key, but subsequent ones do.

If I add a childrecord to a parent that has already been saved, then again, the first one doesn't get the foreignkey, the second one does.

Like I say, chased this one most of the day just can't see what I am doing that's wrong.

thanks

Geoff.

Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Geoff Hirst (05/25/2009)


If I add a new parent record, then go on to add a number of childrecords, save each child, then return to the parent and save the parent, my understanding is that the child records should receive the parents ID upon the parent saving, is this correct?.




Well, if the relationship is setup properly, by saving the child, it will automatically trigger a save in the parent record so a proper PK will be assign to the children records. At this point it will be easier if you provide a quick sample using the SF sample data with all your relations. I posted one a couple of days ago here http://forum.strataframe.net/FindPost23154.aspx it is in C# but it is pretty simple, also in that thread I did a quick explanation on this very issue.


Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It sounds like your reference is not updated. When you say that you overwrote the OnLoad, what does your code look like? You need to call the base logic first, then reset the object reference on the list. Something like this:



Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

MyBase.OnLoad(e)



MyList.BusinessObject = MyBo

End Sub

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search