StrataFrame Forum
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
Second BO not included in Form Save
http://forum.strataframe.net/Topic32428.aspx
By Andrew Harper
-
2/12/2014
Hi,
I have a maintenance form that maintains a primary bo named boPromo. When in Edit mode the user can click a button to load details into a second bo boPromoDetails.
The form "IncludeInFormEditType","IncludeInFormSaveType" and "IncludeInFormUndoType" properties are set to "DeterminedByBusinessObject" .
The form "IncludeInFormAddType","IncludeInFormDeleteType" and "IncludeInFormNavigateType" properties are set to "PrimaryBusinessObject"
boPromo has all the "IncludeInForm..." properties set to True.
boPromoDetails has "IncludeInFormSave" and "IncludeInFormUndo" set to True.
boPromoDetails is not being included in the form Save. If I set a breakpoint in the form BeforeSave then boPromodetails.isDirty = true.
A breakpoint in the boPromoDetails.BeforeSave handler is not fired.
If I code a boPromoDetails.Save() in the form.BeforeSave then boPromoDetails.BeforeSave handler is fired and the details are saved correctly.
What am I missing here?
TIA,
Andy
By Trent L. Taylor
-
2/13/2014
Do you have a relationship setup between the two business objects? When you set the ParentBusinessObject property on the child, it will then make sure that all propagations happen in the right order.
By Andrew Harper
-
2/13/2014
Thanks Trent,
I will try establish the relationship and test. More generally, does this mean that a relationship has to be established to save more than 1 BO at a time?
Best regards Andy
By Trent L. Taylor
-
2/13/2014
No, but if they are related you will want to tie them together. This is important to maintain the integrity of a parent-child relationship. If this isn't a parent-child relationship, then there is something else in the mix. To clear things up, if you can create a quick sample of your problem that could help also.
By Andrew Harper
-
2/13/2014
I located my problem:
1. In the boPromotion.Navigated event I was filling boPromotionDetails with records relating to boPromotion.
2. boPromotion.Navigated is being fired by the form save before boPromotionDetails was being saved, as a result boPromotionDetails.IsDirty became false and no save was performed. I can get around this by checking the form EditingState in boPromotion.Navigated before repopulating boPromotionDetails.
This raises the question as to when to populate related BOs. In the Enquiry only forms that I have developed so far I have always repopulated any child BOs in the parent bo.Navigated event.
In order to use the ChildAutoFilter = MatchCurrentRow on the child BO, from my testing the child BO must first be populated with all the records relating to records in the parent BO.
Am I missing something here? I am interested to hear what others are doing,
TIA
Andy