Second BO not included in Form Save


Author
Message
Andrew Harper
Andrew Harper
StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)
Group: StrataFrame Users
Posts: 87, Visits: 3.3K
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
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
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. 
Andrew Harper
Andrew Harper
StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)
Group: StrataFrame Users
Posts: 87, Visits: 3.3K
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
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
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.
Andrew Harper
Andrew Harper
StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)
Group: StrataFrame Users
Posts: 87, Visits: 3.3K
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
Edited 10 Years Ago by Andrew Harper
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