BeforeSave event not firing in 1.6.6


Author
Message
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I have some code in the beforesave event of one of my business objects. I've verified the handler is still connected. When I set a break point and fire a save on this business object, the code in event handler is not firing. Any ideas?
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
Hi Randy,

Make sure the Business Object property IncludeInFormSave is set to True for that BO.

In case that does not work, please provide more detail info like this:

  • What version of the SF Assemblies are you using?
  • How many BO are you using in this form?
  • Is the mentioned BO a Parent or a Child BO?


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
Edhy's questions are valid, but it appears that the handler isn't attached or the BO is not being saved.  I just setup a test and it works as it should, so let's start digging through your environment.
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
IncludeInFormSave is true. This actually the main BO on an SF Wizard Form. In the Finish_Clicked i'm just calling me.save() - this BO is set as my PrimaryBusinessObject as well. It is the parent.



The handler is connected. In the properties I see the method is linked and when I double click it take me to that code which has Handles MyBase.BeforeSave.





Private Sub DCASetupDataBO_BeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs) Handles MyBase.BeforeSave

Dim nNumberOfSolutions As Integer = 0

If Me.SolutionLevel1 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

If Me.SolutionLevel2 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

If Me.SolutionLevel3 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

Me.NumberSolutions = nNumberOfSolutions

End Sub





Just updated to 1.6.6 - everything builds fine and this was working prior to the update so not sure what could be going on.



File versions are showing 1.6.5.1 on all assemblies in Strataframe version dialog.



Thanks,

Randy











Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I forgot to mention there are other BOs but they are not getting updated by the form so I set them all to be IncludeInFormSave = false



Still no go. I know the save is firing because my checkrulesoncurrentrow is firing which is telling me that my numberofsolutions is required. Hmm... maybe this event fires before the beforesave event now...
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Yep, looks like that is what is happening. Checkrulesoncurrentrow in the bizobj is firing before any of the beforesave events, which sort of makes sense I suppose from a logical standpoint. Knowing this I think I can probably find a workaround. Not using beforesave in too many places.
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
Use the BusinessRulesChecked event.  This will get fired every time and allow you to override any broken rules (if you have that need).  But it will always fire pre-save whether there are broken rules or not.

Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Thanks, I'll give this a try.
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