You are on page 1of 2

/* Call the Virtual Approver */ Virtual_Approver(); /* Set the application records approval status field to

the value */ /* Virtual_Approver returns */ <status_record_field> =


APPR_FIELDS_WRK.APPR_STATUS;
The variables in this code are:
BusProcessName
The name of the business process whose approval rules to use.
Approval_rule_set
The name of the approval rule set that you want Virtual_Approver to useto determine whether an item
needs further approval.
Approval_action
The approval action to provide Virtual_Approver as input. Usually,
approval_action
is the name of the record field in which the user sets theapproval status. It can also be one of the
string constants: P, D, or R.
Note.
If the user specifies the approval action at level 0 on the pagethatis, if the user specifies a single
approval action for the entire pageitspreferable to include the field
APPR_FIELDS_WRK.APPR_ACTION onthe page and let the user set it directly. However, this direct
approachdoesnt work if the user must specify approval actions for each row in ascroll. You must have
the user set the action in another field, then transferthe value to the APPR_ACTION field before the
Virtual_Approver call.
Current_row_number
The current row number in the scroll. Setting this field is not necessary atlevel 0.
Status_record_field
The record field that holds the approval status of the transaction, such asPurchase Request Approval
Status.
Workflow PeopleCode
declare function Virtual_Router PeopleCode APPR_VA0_WRK.FUNCLIB_02
FieldFormula;APPR_FIELDS_WRK.APPR_VR_ROW = <scroll_info>;Virtual_Router();if
None(APPR_INSTANCE) thenAPPR_INSTANCE = APPR_FIELDS_WRK.APPR_INSTANCE;endif;
The
scroll_info
is a number. If youre calling the router from level 0,
scroll_info
is 0; if yourecalling it from a scroll,
scroll_info
is the row number of the current row in the scroll. If yourecalling from a level 1 to level 3 scroll, use the
CurrentRowNumber() function.
Chapter 2- Alternatives & Enhancements
1.
We can also map OPRID to a work field OPRID to which we can assign a value on theworkflow event
just before we call TriggerBusinessEvent () function. Please make sure toinclude this work field on
your page if you want it to appear in the map field box above.Typically, we fetch OPRID values oneby-one from a separate set-up page where wemaintain a list of approvers.2.
Further, any particular &ROLEUSER can also be fetched with the help of these 2 queriesunder a set of
conditions: SQLExec("select ROLENAME from ps_appr_rule_detl where appr_rule_set = :1 AND APPR_STEP
=:2","APPROVAL RULE SET", &APPR_STEP, &ROLENAME);SQLExec("select B.roleuser from
ps_rte_cntl_ln A, ps_rte_cntl_ruser B where A.RTE_CNTL_PROFILE =B.RTE_CNTL_PROFILE and
A.rte_from_value >=:1 and A.rte_to_value<=:1and B.rolename=:2",BUSINESS UNIT , &ROLENAME,
&ROLEUSER);
3.

For any approver, at least one field on the page should change its value (includingapproval action) for
trigger of workflow to next level.4.
SMTP server needs to be configured, otherwise we cannot use email/message option inactivity
directly in the worklist item.5.
If I want to have 2 different pages in my activity, I can achieve that using 2 different steps-say 1 for
approve, other for deny6.
In ARS based workflows, if you untick 'approval active', virtual router doesnt check theARS rules and
request is approved fully as soon as saved. Further, if you tick 'self approval, it means you can
approve your request but subjected to
amount
and
quantity
rules.7.
ARS based workflows ultimately operate on triggerbusinessevent () only internally.However, when we
have requirements which are highly non-uniform in nature w.r.t.routing of our workflow or approver
options, we use the triggerbusinessevent () workflowand customize it through peoplecode.8.
In ARS based workflows, if our requirement is a 3-level workflow (i.e. 3 approvers), wemay keep 4
roles or steps in the ARS and assign 2 roles to 1 of the approvers. This will bea flexible design for
future in case the no. of approvers goes up to 4 say for a differentbusiness unit or route control
profile.9.
The Route Control Queries (mentioned in ARS based workflows) can be studied or testedfrom front
end (Reporting Tools> Query> Query Manager).
TROUBLESHOOTING SOME COMMON WORKFLOW PROBLEMS
1.
Check the Worklist User checkbox in the Workflow tab of the userid inPeopletools>security>user
profiles before proceeding ahead.2.
Check the relevant role & route control profile of the user in case of approval rule setbased
workflows.3.
Worklist item getting transferred but approval page not opening up component's searchrecord OPRID
not getting updated- Check the SQL view query of the search record.4.
How to monitor my workflows(status/level of approval) from front end PeopleTools>Workflow> Monitor
Worklist> Update Worklist Entries.
REFERENCES
PeopleTools 8.44 PeopleBook: Workflow Technology-- End of document --

You might also like