Want to allow AWE Approvers to add comments to the transaction that would show up within the Approval Monitor?
This is how I approached it. First I looked in the EOAW_CORE:ApprovalEventHandler for the word "comment" and I found where the delivered code inserts comments using the Thread class, then I examined the thread methods and founds two promising methods.
method AddComments(&username As string, &comments As string);
method AddCommentsHistory(&username As string, &comments As string, &history As string);
First I started with the AddComments method, but this only appeared to show the last comments in the monitor, and we wanted to show the comment history. Maybe that is why the second method is called AddCommentsHistory?
So I Called this Method from my event handlers and it worked the way I expected, allowing me to add comments, while preserving the comment history. However, it created a new comment area within the Approval Status Monitor call "Comment History".
Within my Registered Event Handlers I added two private methods to handle getting the current approver's comments and calling the delivered thread method to store the comments.
method getComments
/+ &thread as EOAW_CORE:ENGINE:Thread +/
/+ Returns String +/
Local string &comments;
If %Component = Component.ZZ_REQUISITIONS Or
%Component = Component.ZZ_ADM_REQUISITION Then
&comments = ZZ_BR_APPR_WRK.COMMENTS.Value;
ZZ_BR_APPR_WRK.COMMENTS.Value = "";
End-If;
Return &comments;
end-method;
method addComments
/+ &thread as EOAW_CORE:ENGINE:Thread +/
Local string &userName;
Local string &checkComments;
Local ZZ_UTILITIES:getUserName &getName;
rem call local utility to return user name for addCommentsHistory;
&getName = create ZZ_UTILITIES:getUserName();
&userName = &getName.getUserNamebyOprid(%OperatorId);
&checkComments = %This.getComments(&thread);
If All(&checkComments) Then
&thread.AddCommentsHistory(&userName, &checkComments, &thread.getHistory());
End-If;
end-method;
Then I just added the following code to the OnStepComplete, OnHeaderDeny and the OnProcessLaunch.
%This.addComments(&thread);
Variable &thread is not declared. Eventhough I declared it is giving me this error
ReplyDeleteThis post was done in tools 8.53, since then code has changed. You need to find a way to get to the current thread, so you can add your comments. When &stepinst is passed then the code should look like this: %This.addComments(&stepinst.path.thread); OnProcessLaunch it should look like this %This.addComments(&appinst.thread); OnHeaderDeny it should look like this %This.addComments(&userinst.thread);
Delete