I have a notification which i send to approver for approval.
We show approve and reject buttons along with the reassign button which comes automatically.
But here i want to put some logic in case the approver reassigns the approval to some other person(clicks on reassign).
So how can i handle this in pl/sql code.
Oracle Workflow notifications can be extended to perform extra validation or processing when the notification is being responded to. And these possibilities translate into PLSQL seeded variables that can be used to extend notifications functionality. The standard PLSQL procedure used in function activity provides the parameter 'funcmode' which will have the following values:
'RESPOND', 'VALIDATE, and 'RUN' for a notification is responded to (approve, reject, etc)
'FORWARD' for a notification being forwarded to another user
'TRANSFER' for a notification being transferred to another user
'QUESTION' for a request of more information from one user to another
'QUESTION' for a response to a request of more information
'TIMEOUT' for a timed-out notification
'CANCEL' when the notification is being re-executed in a loop.
So let's assume there is a notification that can only be approved a certain people thus any attempt to transfer or delegate such notification should be allowed only to users OPERATIONS or SYSADMIN. The way to implement this functionality would be as follows:
1. Edit the corresponding workflow definition in Workflow Builder and open the notification.
2. In the Function Name enter the name of the procedure where the custom code is handled, for instance, TEST_PACKAGE.Post_Notification
3. In PLSQL create the corresponding package TEST_PACKAGE with a procedure named Post_Notification, as follows:
procedure Post_Notification (itemtype in varchar2,
itemkey in varchar2,
actid in varchar2,
funcmode in varchar2,
resultout in out nocopy varchar2) is
if funcmode in ('TRANSFER','FORWARD') then
select count(1) into l_count
where WF_ENGINE.context_new_role in ('OPERATIONS','SYSADMIN');
--and/or any other conditions
if l_count<1 then
4. Launch the workflow process with the changed notification and attempt to reassign or transfer it. You will see an error message.
Check the Workflow API Reference Guide, section Post-Notification Functions, to see all the standard, seeded WF_ENGINE variables available for extending notifications processing.