This discussion is archived
2 Replies Latest reply: Aug 1, 2012 3:48 AM by Navneet01 RSS

Workflow notification help

Navneet01 Newbie
Currently Being Moderated
Hi

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.

Thanks
Navneet
  • 1. Re: Workflow notification help
    AlejandroSosa Journeyer
    Currently Being Moderated
    Navneet.

    Here an excerpt from a blog of mine:

    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
    l_count number;
    begin
    if funcmode in ('TRANSFER','FORWARD') then
    select count(1) into l_count
    from WF_ROLES
    where WF_ENGINE.context_new_role in ('OPERATIONS','SYSADMIN');
    --and/or any other conditions
    if l_count<1 then
    WF_CORE.TOKEN('ROLE', WF_ENGINE.context_new_role);
    WF_CORE.RAISE('WFNTF_TRANSFER_FAIL');
    end if;
    end if;
    end Post_Notification;
    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.

    Regards,

    Alejandro
  • 2. Re: Workflow notification help
    Navneet01 Newbie
    Currently Being Moderated
    Thanks Alejandro

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points