| Previous | Next | Contents | Index | Glossary |
Result Type
This activity expects a response of 'T' if an approver is found or 'F' if an approver is not found. The possible responses are defined in a lookup type called Boolean, associated with the Standard item type.
PL/SQL Stored Procedure
The PL/SQL stored procedure that this function activity calls is described in detail below. Each section in the procedure is numbered with the notation 1-> for easy referencing.
| procedure SelectApprover ( | itemtype | in varchar2, | |||
| itemkey | in varchar2, | ||||
| actid | in number, | ||||
| funcmode | in varchar2, | ||||
| resultout | out varchar2 ) is | ||||
| 1-> | l_forward_from_username | varchar2(30); | |||
| l_forward_to_username | varchar2(30); | ||||
| 2-> | begin | ||||
| if ( funcmode = 'RUN' ) then | |||||
| l_forward_to_username := wf_engine.GetItemAttrText ( | |||||
| itemtype => itemtype, | |||||
| itemkey => itemkey, | |||||
| aname => 'FORWARD_TO_USERNAME'); | |||||
| 3-> | if (l_forward_to_username is null) then | ||||
| l_forward_to_username := wf_engine.GetItemAttrText ( | |||||
| itemtype => itemtype, | |||||
| itemkey => itemkey, | |||||
| aname => 'REQUESTOR_USERNAME'); | |||||
| end if; | |||||
| 4-> | l_forward_from_username := l_forward_to_username; | ||||
| 5-> | wf_engine.SetItemAttrText | (itemtype => itemtype; | |||
| itemkey => itemkey, | |||||
| aname => 'FORWARD_FROM_USERNAME'; | |||||
| avalue => l_forward_from_username); | |||||
| 6-> | l_forward_to_username := wf_reqdemo.GetManager( l_forward_from_username); | ||||
| 7-> | wf_engine.SetItemAttrText | (itemtype => itemtype; | |||
| itemkey => itemkey, | |||||
| aname => 'FORWARD_TO_USERNAME'; | |||||
| avalue => l_forward_to_username); | |||||
| 8-> | if (l_forward_to_username is null) then | ||||
| resultout :='COMPLETE:F'; | |||||
| else | |||||
| resultout :='COMPLETE:T'; | |||||
| end if; | |||||
| 9-> | end if; | ||||
| 10-> | if (funcmode = 'CANCEL') then | ||||
| resultout :='COMPLETE'; | |||||
| return; | |||||
| end if; | |||||
| 11-> | if (funcmode = 'TIMEOUT') then | ||||
| resultout :='COMPLETE'; | |||||
| return; | |||||
| end if; | |||||
| 12-> | exception | ||||
| when others then | |||||
| wf_core.context('WF_REQDEMO','SelectorApprover',itemtype, itemkey,actid,funcmode); | |||||
| raise; | |||||
| 13-> | end SelectApprover; | ||||
1-> The local arguments l_forward_from_username, and l_forward_to_username are declared in this section.
2-> If the value of funcmode is RUN, then retrieve the name of the last person that this requisition was forwarded to for approval by assigning l_forward_to_username to the value of the FORWARD_TO_USERNAME item type attribute, determined by calling the Workflow Engine API GetItemAttrText. See: GetItemAttribute.
3-> If the value of l_forward_to_username is null, then it means that the requisition has never been forwarded for approval. In this case, assign it the value of the REQUESTOR_USERNAME item type attribute, determined by calling the Workflow Engine API GetItemAttrText.
4-> Assign l_forward_from_username to the value of l_forward_to_username.
5-> This section assigns the value of l_forward_from_username to the FORWARD_FROM_USERNAME item type attribute by calling the Workflow Engine SetItemAttrText API.
6-> This section calls the function GetManager to return the manager of the previous approver stored in l_forward_from_username, from the WF_REQDEMO_EMP_HIERARCHY table and assigns that manager's name to l_forward_to_username.
7-> This section assigns the value of l_forward_to_username to the FORWARD_TO_USERNAME item type attribute by calling the Workflow Engine SetItemAttrText API.
8-> If l_forward_to_username is null, meaning there is no manager above the previous approver in the hierarchy, then assign resultout to be COMPLETE:F. Otherwise, assign resultout to be COMPLETE:T.
9-> This ends the check on funcmode =' RUN'.
10-> If the value of funcmode is CANCEL, then assign resultout to be COMPLETE.
11-> If the value of funcmode is TIMEOUT, then assign resultout to be COMPLETE.
12-> This section calls WF_CORE.CONTEXT if an exception occurs.
13-> The SelectApprover procedure ends.
| Previous | Next | Contents | Index | Glossary |