This is an issue I have always had, but never really found a need to ‘resolve’ until now. It boils down to catching the end of the event when a new record is created (Order, Quote, QuoteDtl, etc.).
In this instance, I am trying to catch when a user clicks on the “New Quote” button on the Opportunity/Quote entry screen and the process to create the quote finishes. IE: the Quote Number is set to 0 and everything is initialized waiting for user input.
Once that is done, I need to set the value of a field in the QuoteHed EpiDataView. I have a textbox with that value so I can see what it is at any given time.
I tried checking when the EpiDataViewNotification was triggered and the NotifyType is Initialize and Row > -1, which triggers multiple times…It seems that when that triggers the 1st time, it sets the value, but it immediately triggers again and blanks the value out…each subsequent time it triggers (which I think is 4 or 5 times when the New button is clicked) it never sets it back to what it want it to be set as (at least the textbox I have on screen doesn’t reflect it).
The code block is very simple, as shown here:
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) AND (args.Row >-1) Then
Dim edvQuoteHed As EpiDataView = CType(Script.oTrans.EpiDataViews(QuoteHed),EpiDataView)|
Dim edvQuoteHedRow As System.Data.DataRow = edvQuoteHed.CurrentDataRow|
UserName = QuoteForm.Session.UserName
edvQuoteHedRow("Owner_c") = UserName
End If
My texbox is bound to QuoteHed.Owner_c
I have tried similar approaches with AfterAdapter methods and such, but the results are always the same: The texttbox is empty when all is said and done.
Is this something that would be better off being handled in a BPM for when a new quotehed record is added? Or am I missing a step on the customization? (IE: I am checking the wrong thing to see if the new record has been created? If I go the BPM route, will that trigger before anything is actually saved to the DB? (IE: the user hasn’t actually saved the quote yet…so the QuoteNum textbox/field is still showing 0)?