LaunchManager Class Methods
Application developers should instantiate this class as a component-scoped variable. The best place to initialize this class is in the component post-build event. This section describes the LaunchManager class methods. The methods are discussed in alphabetical order.
LaunchManager
Syntax
LaunchManager(&awprcs_id, &hdr_ , &requester_)
Description
Launches the Approval Framework process.
Parameters
Parameter |
Description |
---|---|
&awprcs_id |
The approval Process ID that has been defined in the Transaction Registry, as string. |
&hdr_ |
The header record defined for the approval processes in the Transaction Approval Levels in the Transaction Registry, as record. |
&requester_ |
The Operator ID of the user initiating the approval process, as string. |
Returns
None.
Example
This is an example to launch Approval Framework for VoucherApproval.
import EOAW_CORE:*; Component EOAW_CORE:LaunchManager &launchMgr; If VOUCHER.VCHR_APPRVL_FLG = "W" Then &vchrRecord = CreateRecord(Record.VCHR_AF_HDR_VW); GetLevel0()(1).GetRecord(Record.VOUCHER).CopyFieldsTo(&vchrRecord); &launchMgr = create EOAW_CORE:LaunchManager("VoucherApproval", &vchrRecord, %OperatorId);
DoSubmit
Syntax
DoSubmit()
Description
Used to submit a new transaction for approval. An exception is thrown if the property submitEnabled is not true.
Parameters
None.
Returns
None.
Example
This is an example of submitting the transaction.
import EOAW_CORE:*; Component EOAW_CORE:LaunchManager &launchMgr; &launchMgr.DoSubmit();
DoReSubmit
Syntax
DoReSubmit()
Description
Used to resubmit a transaction which was previously submitted, and the previous approval processes have completed (approved, denied or terminated). An exception is thrown if the property resubmitEnabled is false.
Parameters
None.
Returns
None.
Example
This is an example to resubmit a process:
import EOAW_CORE:*; Component EOAW_CORE:LaunchManager &launchMgr; &launchMgr.DoReSubmit();
DoRestart
Syntax
DoRestart()
Description
Used to restart a currently running approval process. An exception is thrown if the property restartEnabled is false.
For example, in eProcurement, a requisition can be modified after has been approved. Since it was approved, Approval Framework sees it as closed (ended) and will not allow it to be resubmitted. The only option is to restart the transaction. Restart will reset all approval actions and route to the first approver regardless of the previous approvals.
Parameters
None.
Returns
None.
PrepareToSubmit
Syntax
PrepareToSubmit()
Description
This method instantiates an approval process, but does not save or launch it. Repeated calls to this method do nothing, if an approval process has been instantiated (or if an approval process is running), this method simply returns. The point is that the requester can add ad-hoc approvers while previewing which will be included in the process launched by DoSubmit(). The DoSubmit(), DoResubmit(), DoPreview() and DoRestart() methods all call this method. So any approval process instantiated by DoPreview() will be reused by the above methods. When this behavior is not desired, application developers use the Reset() method.
Note: Repeated calls to prepare to submit can result in performance problems. Typically, this method is only used when ready to submit or when previews are necessary.
Parameters
None.
Returns
None.
SetHeader
Syntax
SetHeader(&hdr_)
Description
When creating a new application transaction, some applications do not fully populate the key fields until it is saved. For instance, eProcurement uses a generated id number for requisitions, but does not populate the id field until a new transaction is saved. Since applications need to initialize the LaunchManager object in the component post-build event code, this poses a challenge. In such situations, application developers can safely call this method to reset the header record before submitting a new transaction for approvals. It is always safe to call this method as long as the header record being passed in is valid. However when this method will re-instantiate the approval process, which eliminates any performance improvements achieved by caching previewed instances.
Parameters
Parameter |
Description |
---|---|
&hdr_ |
The header record defined for the approval processes in the Transaction Approval Levels in the Transaction Registry, as record. |
Returns
None.
Example
&reqRecord = CreateRecord(Record.PV_REQHDR_AW_VW); GetLevel0()(1).GetRecord(Record.REQ_HDR).CopyFieldsTo(&reqRecord); &launchMgr.SetHeader(&reqRecord); &launchMgr.DoSubmit();
Reset
Syntax
Reset()
Description
This method clears the approval process instance cached by the DoPreview() method. Approval process instances are cached between DoPreview() and DoSubmit() calls because a requester can add ad-hoc approvers to the previewed process before submitting. If ad-hoc approvers are added, using DoSubmit() to regenerate the approval process instance would cause the ad-hoc approvers to be lost. However, application developers must take care to call Reset() if the requester changes any significant fields between calls to DoPreview() and DoSubmit(). Since the Approval Framework does not know which fields are significant, this responsibility falls to the application developer. If concerned about catching all such situations, developers can adopt the strategy of always calling Reset() before calling DoSubmit() or any of its cousins. But this runs the risk of losing any ad-hoc approvers added by the requester during preview. Finally, if the application allows users to change the requester (for instance, when one user submits a transaction on behalf of another), the LaunchManager property requester needs to be updated. Updating the requestor property automatically calls the Reset() method.
Parameters
None.
Returns
None.
FindDefinitionID
Syntax
FindDefinitionID()
Description
This method will return all definition IDs that have criteria matches. A developer can set the definition ID using the definitionID property. If a method such as DoSubmit or DoResubmit is called before this property is set, Approval Framework will use the first definition ID returned based on priority order.
Parameters
None.
Returns
Array of records.
TerminateRunningProcess
Syntax
TerminateRunningProcess()
Description
Terminates a running process.
Parameters
None.
Returns
None.