Call Another BO's Method in Updatable BAQ

I’m working on an updatable BAQ that will update some QuoteHed fields and some Task fields. Why the task fields? Well, because we want to be able to “Lose” quotes without running a process (ie. manually). So, I have this BAQ setup with the appropriate QutoeHed and Task fields, and am running the “Advanced BPM Processing” on the Update tab. Here is the code that I have, but it’s not updating the Task:

/* Update procedure */

def var hProc as handle no-undo.
def var errorsOccured as logical no-undo.
run createConstants.
run bo/Quote/Quote.p persistent set hProc.
do on error undo, leave:
for each ttResults where ttResults.RowMod <> '' on error undo, next:
    dataset QuoteDataSet:empty-dataset().


    create ttQuoteHed.
    run ZeroizeBuf(temp-table ttQuoteHed:default-buffer-handle).
    ttQuoteHed.RowIdent = '#' + ttResults.RowIdent.
    ttQuoteHed.CheckBox11 = ttResults.QuoteHed_CheckBox11.
    ttQuoteHed.CheckBox20 = ttResults.QuoteHed_CheckBox20.
    ttQuoteHed.Company = Constants.CurrentCompany.
    ttQuoteHed.Date20 = ttResults.QuoteHed_Date20.
    ttQuoteHed.DocTotalExpected = ttResults.QuoteHed_DocTotalExpected.
    ttQuoteHed.EntryDate = ttResults.QuoteHed_EntryDate.
    ttQuoteHed.FollowUpDate = ttResults.QuoteHed_FollowUpDate.
    ttQuoteHed.QuoteNum = ttResults.QuoteHed_QuoteNum.
    ttQuoteHed.ShortChar01 = ttResults.QuoteHed_ShortChar01.

    run UpdateExt in hProc(input-output dataset QuoteDataSet, true, true, output dataset BOUpdErrorDataset, output errorsOccured).
    if IsInfoPromptHandlerInvoked() then return.
    /*ttResults.RowMod = ''.*/

        find first ttQuoteHed where ttQuoteHed.RowIdent = '#' + ttResults.RowIdent no-error.
        if available ttQuoteHed then do:
	ttResults.QuoteHed_CheckBox11 = ttQuoteHed.CheckBox11.
	ttResults.QuoteHed_CheckBox20 = ttQuoteHed.CheckBox20.
	ttResults.QuoteHed_Date20 = ttQuoteHed.Date20.
	ttResults.QuoteHed_DocTotalExpected = ttQuoteHed.DocTotalExpected.
	ttResults.QuoteHed_EntryDate = ttQuoteHed.EntryDate.
	ttResults.QuoteHed_FollowUpDate = ttQuoteHed.FollowUpDate.
	ttResults.QuoteHed_QuoteNum = ttQuoteHed.QuoteNum.
	ttResults.QuoteHed_ShortChar01 = ttQuoteHed.ShortChar01.
    end.

    if errorsOccured then temp-table ttErrors:copy-temp-table(temp-table ttBOUpdError:handle, true, ?, true).
end.
finally:
    delete object hProc.
    for each ttErrors where ttErrors.ErrorRowIdent begins '#':
        ttErrors.ErrorRowIdent = substring(ttErrors.ErrorRowIdent, 2).
    end.

/* Task Update adapter*/
For each ttQuoteHed where ttQuoteHed.RowMod='U':
DEF VAR hTask as handle no-undo.
run bo/task/task.p persistent set hTask.
if valid-handle (hTask) then do:
find first Task where Task.Company = Cur-comp and Task.RelatedToFile=ttResults.Task_RelatedToFile and task.key1=ttResults.Task_Key1 and task.key2=ttResults.Task_Key2 and task.Key3=ttResults.Task_key3 and task.TaskSeqNum=ttResults.Task_TaskSeqNum no-lock no-error.
if avail task then do:
run GetTaskCnt in hTask.
Task.Company='4BUS'.
Task.RelatedToFile=ttResults.Task_RelatedToFile.
task.key1=ttResults.Task_Key1.
task.key2=ttResults.Task_Key2.
task.Key3=ttResults.Task_key3.
task.TaskSeqNum=ttResults.Task_TaskSeqNum.
Task.TaskDescription=ttResults.Task_TaskDescription.
task.ReasonCode='PRICE'.
Task.Conclusion=ttResults.Task_Conclusion.
Task.Complete=true.
run UpdateExt in hTask.
Delete Object hTask.
end.
end.
end.
/*End Task Update adapter*/

end finally.

end.

Any ideas on how I can get the “Task Update adapter” portion to work from the QuoteHed BPM process?

Should you have ttQuoteHed or ttResults? And would the ttQuoteHed.RowMod still be U after the updateext

Greg,

You’re right, I should have been testing ttResults.RowMod, not ttQuoteHed. I also forced the QutoeHed update portioin to set the ttResults.RowMod=‘U’. Still no joy though. The update process doesn’t throw any errors, but still no update to the Task.

In later versions of E9 you do not have to call the BO to do the update. I got an example from EpicWeb to start with, but the basics are simple.

Something like below. Set as Advanced BPM update only and then base processing.

Greg


/* update QuoteHed */

For Each ttResults where ttResults.RowMod <> ‘’ on error undo, next:

For each QuoteHed where QuoteHed.Company = cur-comp and QuoteHed.SysRowID = ttResults.QuoteHed_SysRowID exclusive-lock.

QuoteHed.CheckBox11 = ttResults.QuoteHed_CheckBox11.
QuoteHed.CheckBox20 = ttResults.QuoteHed_CheckBox20.
QuoteHed.Company = Constants.CurrentCompany.
QuoteHed.Date20 = ttResults.QuoteHed_Date20.
QuoteHed.DocTotalExpected = ttResults.QuoteHed_DocTotalExpected.
QuoteHed.EntryDate = ttResults.QuoteHed_EntryDate.
QuoteHed.FollowUpDate = ttResults.QuoteHed_FollowUpDate.
QuoteHed.QuoteNum = ttResults.QuoteHed_QuoteNum.
QuoteHed.ShortChar01 = ttResults.QuoteHed_ShortChar01.
End.

For first Task where Task.Company = Cur-comp and Task.RelatedToFile=ttResults.Task_RelatedToFile and
										  task.key1=ttResults.Task_Key1 and task.key2=ttResults.Task_Key2 and
										  task.Key3=ttResults.Task_key3 and task.TaskSeqNum=ttResults.Task_TaskSeqNum exclusive-lock.
	
			
			Task.Company='4BUS'.
			Task.RelatedToFile=ttResults.Task_RelatedToFile.
			task.key1=ttResults.Task_Key1.
			task.key2=ttResults.Task_Key2.
			task.Key3=ttResults.Task_key3.
			task.TaskSeqNum=ttResults.Task_TaskSeqNum.
			Task.TaskDescription=ttResults.Task_TaskDescription.
			task.ReasonCode='PRICE'.
			Task.Conclusion=ttResults.Task_Conclusion.
			Task.Complete=true.

End.
End.


Well, that certainly makes things a lot easier…lol!
I’m running 9.05.702, and can confirm that this is correct. I have updated the BAQ’s MassUpdate BPM, and all is working as expected from within the BAQ designer.
Thanks for the tip Greg!