Tuesday 16 November 2021

Date Format in BI Publisher

 Format Current Date 

Date: <?xdoxslt:sysdate(‘DD-MON-YYYY HH24:MI’)?>


Format Date Variable 

<?format-date:A.CLASS_ATTEND_DT;'DD-MON-YYYY'?>










Saturday 6 November 2021

AWE Ad Hoc Approver is disappearing

 I’ve got a custom AWE process, and when I try to add an Ad Hoc reviewer , I click the + button, pick a person, and everything looks fine. But when I click the standard Save button, the Ad Hoc approver disappears. On the other hand, if I click the Approve button, the process moves forward and saves the Ad Hoc reviewer.


I got this to work. If you look at the class EOAW_CORE:ENGINE:AppInst you can see this comment.

/** Has this approval process instance been saved? The process is automatically saved upon launch (and upon approve/deny, etc.–see SaveAdHocs(), below), but may also be saved by calling the Save() method explicitly. This can be necessary when users add ad-hoc approvers while previewing the process, for instance. */

At first I tried

import EOAW_CORE:LaunchManager;

import EOAW_CORE:ApprovalManager;


Declare Function createStatusMonitor PeopleCode EOAW_MON_WRK.EOAW_FC_HANDLER FieldFormula;

Component string &c_apprAction;

Component EOAW_CORE:LaunchManager &c_aweLaunchManager;

Component EOAW_CORE:ApprovalManager &c_aweApprManager;


If (L_MINOR_APP_FRM.L_MINOR_ACTV.Value = "Y") Then

   Local Record &headerRec = GetRecord(Record.L_MINOR_APP_FRM);

   Local boolean &isApprover;

   

   Local number &resp;

   

   Evaluate &c_apprAction

   When "A"

      &c_aweApprManager.AddComments(%OperatorId, &headerRec, L_MINOR_APP_WRK.COMMENTS.Value);

      &c_aweApprManager.DoApprove(&headerRec);

      L_MINOR_APP_WRK.COMMENTS.Visible = False;

      L_MINOR_APP_FRM.L_MIN_CRDNTR_CNFRM.DisplayOnly = True;

      

      

      Break;

   When "D"

      &c_aweApprManager.AddComments(%OperatorId, &headerRec, L_MINOR_APP_WRK.COMMENTS.Value);

      &c_aweApprManager.DoDeny(&headerRec);

      L_MINOR_APP_WRK.COMMENTS.Visible = False;

      L_MINOR_APP_FRM.L_MIN_CRDNTR_CNFRM.DisplayOnly = True;

      

      Break;

      

   When "S"

      

      &c_aweApprManager.AddComments(%OperatorId, &headerRec, L_MINOR_APP_WRK.COMMENTS.Value);

      L_MINOR_APP_FRM.L_MIN_CRDNTR_CNFRM.DisplayOnly = True;

      L_MINOR_APP_WRK.COMMENTS.Visible = False;

      If &c_aweApprManager.hasAppInst Then

         

         &c_aweApprManager.the_inst.Save();

         

      End-If;

      

      Break;

      

      

      

   End-Evaluate;

   

   

   

   If &c_aweApprManager.hasAppInst Then

      &isApprover = &c_aweApprManager.hasPending;

      createStatusMonitor(&c_aweApprManager.the_inst, "D", Null, False);

      L_MINOR_APP_WRK.DENIAL_BTN.DisplayOnly = True;

      L_MINOR_APP_WRK.APPROVE_BTN.DisplayOnly = True;

      L_MINOR_APP_WRK.SAVEBTN.DisplayOnly = True;

   End-If;

End-If;


Allow AdHoc Approver in AWE

 Certain approver is absent or could not approve the step on time (there is a timeout). So a special user could have the ability to modify ("bend") the current approval workflow in this special case. This is called adhoc approver.

In my case, AWE will grant a user the ability to modify the workflow if that user has enough permissions to do that (an specific role called "L_MINOR_APP_CORDINATOR_APRVR").

created a custom application package to handle this feature. The package will re-implement some methods.

import EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase;

import EOAW_CORE:ENGINE:StepInst;

import EOAW_CORE:ENGINE:StageInst;



class L_AdHocClass extends EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase

   method allowInsert(&oprid As string, &stepBefore As EOAW_CORE:ENGINE:StepInst, &stepAfter As EOAW_CORE:ENGINE:StepInst) Returns boolean;

   method allowDelete(&oprid As string, &currentStep As EOAW_CORE:ENGINE:StepInst) Returns boolean;

   method allowNewPath(&oprid As string, &stage As EOAW_CORE:ENGINE:StageInst) Returns boolean;

   method allowRequestInfo() Returns boolean;

private

   method isWorkFlowAdmin(&oprid As string) Returns boolean;

end-class;



method allowInsert

   /+ &oprid as String, +/

   /+ &stepBefore as EOAW_CORE:ENGINE:StepInst, +/

   /+ &stepAfter as EOAW_CORE:ENGINE:StepInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowInsert +/

   Return %This.isWorkFlowAdmin(&oprid);

end-method;



method allowDelete

   /+ &oprid as String, +/

   /+ &currentStep as EOAW_CORE:ENGINE:StepInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowDelete +/

   If (%Super.allowDelete(&oprid, &currentStep)) Then

      Return True;

   Else

      Return %This.isWorkFlowAdmin(&oprid);

   End-If;

end-method;



method allowNewPath

   /+ &oprid as String, +/

   /+ &stage as EOAW_CORE:ENGINE:StageInst +/

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowNewPath +/

   Return False;

end-method;



method allowRequestInfo

   /+ Returns Boolean +/

   /+ Extends/implements EOAW_MONITOR:ADHOC_OBJECTS:adhocAccessLogicBase.allowRequestInfo +/

   Return False;

end-method;



method isWorkFlowAdmin

   /+ &oprid as String +/

   /+ Returns Boolean +/

   Local string &is_admin;

   Local string &strRol = "L_MINOR_APP_CORDINATOR_APRVR";

   

   If (%Component = "L_MINOR_APP_APRVL") Then

      SQLExec("SELECT ROLENAME FROM PSROLEUSER WHERE ROLEUSER = :1 AND ROLENAME = :2", &oprid, &strRol, &is_admin);

      Return (All(&is_admin));

   Else

      Return False;

   End-If;

end-method;


Tuesday 2 November 2021

How do I pass bind variables to Message Explain text in message catalog?

 


      &string = MsgGetExplainText(10001, 5, "Error Message", L_MINOR_CRSES.DESCR.Value);

      &string1 = MsgGetExplainText(99999, 1, """");

      Error (&string);