Writing PeopleCode for Approval Processes

This section provides an overview of writing PeopleCode for approval processes.

Approval processes are a common form of business process. PeopleSoft has simplified the process of defining approval processes by enabling you to define approval rules on an approval rule setmap. You can then choose a tool to read and implement the approval rules from the map.

As users complete transactions that require approvals, Virtual Approver determines the appropriate approver and sends a workflow routing. As each approver completes the approval, Virtual Approver determines whether additional approvals are needed and, if necessary, sends additional workflow routings.

To trigger Virtual Approver from a page, use two PeopleCode functions in the record definition that is associated with the page:

  • Use the Virtual_Approver function in the SaveEdit PeopleCode.

    This function checks the approval rules that you defined in the approval rules sets and determines whether an item must be routed for approval.

  • Use the Virtual_Router function in the Workflow PeopleCode.

    This function routes items to the next step in the approval process.

The GetApprovers function is not a regular PeopleCode function; it is a library function, like Virtual Approver. It is located in the FieldFormula event of the APPR_VA0_WRK.APPR_RULE_SET record field.

The GetApprovers PeopleCode function checks an approval rules set and determines the entire list of required approvals at once, so that you can develop custom approval tracking applications.