Using GetApprovers PeopleCode

GetApprovers PeopleCode determines the entire list of required approvals based on the rules that are defined in an approval rule set. GetApprovers evaluates all approval steps at once so that you receive a complete list of approvers from the entire approval chain.

Typically, you include GetApprovers in the Workflow PeopleCode for the transaction that requires approval.

Syntax

GetApprovers (approval_rule_set, evaluation_fields_rowset, approvers_rowset, approvers_record)

Description

The GetApprovers function:

  • Evaluates each step in the approval rule set.

  • Ignores a step when the rules for the step indicate that no approver is necessary.

  • Obtains the role users for a step when the rules for the step indicate that an approver is required.

    GetApprovers identifies the role users using the method defined in the step: with either a SQL object or a route control.

After every step has been evaluated, the results are returned to the calling program as a rowset object.

Parameters

Parameter

Description

approval_rule_set

The approval rule set name.

evaluation_fields_rowset

The rowset containing the fields that the rules evaluate. The records and fields referenced by the approval rule set must be at the current level, that is, the same level as the call to GetApprovers.

approvers_rowset

A rowset created from the record APPR_USERLIST. GetApprovers adds rows for each required approval.

approvers_record

The name of the record in which the returned approver data is stored.

Returns

Returns a rowset with the following data for each required approver:

  • ROLEUSER

  • ROLENAME

  • STEP

  • PATH

GetApprovers also inserts this data into a record that you specify.

Example

GetApprovers("ORDER_APPROVAL", GetLevel0(), GetLevel0()(1).GetRowset(Scroll.APPR_USERLIST), "APPR_USERLIST")