1 Reply Latest reply: Mar 14, 2013 2:44 PM by ManBahel RSS

    PO approval Work flow

    ManBahel
      Dear All,
      Our users need to share the work list for PO Approval workflow with others in the dept. but if the user other than the one who was the initial recipient of the notification approves the PO; the workflow approval history still shows the original recipients name and not the responder as the approver. It does not even puts the message as "Approving on behalf of" as in the case if the notification is forwarded to other user.

      Any suggestions how to capture the responder as approver?

      Edited by: 989622 on Mar 6, 2013 6:27 AM
        • 1. Re: PO approval Work flow
          ManBahel
          I was able to find where it is doing it.

          The PO_WF_PO_NOTIFICATION.POST_APPROVAL_NOTIF has a logic (which does not make much sense) but if the session owner (logged in user) is not equal to the original recipient of the notification it reverts the responder to the original recipient.

          SELECT fu.USER_ID
          INTO l_responder_id
          FROM fnd_user fu,
          wf_notifications wfn
          WHERE wfn.notification_id = l_nid
          AND wfn.original_recipient = fu.user_name;

          l_session_user_id := fnd_global.user_id;

          IF (l_responder_id is not null) THEN

          IF (l_responder_id <> l_session_user_id) THEN

          /* possible in 2 scenarios :
          1. when the response is made from email using guest user feature
          2. When the response is made from sysadmin login
          */

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_USER_ID',
          avalue => l_responder_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_RESP_ID',
          avalue => l_preparer_resp_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_APPL_ID',
          avalue => l_preparer_appl_id);
          ELSE

          IF (l_session_resp_id is null) THEN

          /* possible when the response is made from the default worklist
          without choosing a valid responsibility */

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_USER_ID',
          avalue => l_responder_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_RESP_ID',
          avalue => l_preparer_resp_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_APPL_ID',
          avalue => l_preparer_appl_id);
          ELSE

          /* all values available - possible when the response is made
          after choosing a correct responsibility */

          /* bug 5333226 : If the values of responsibility_id and application
          id are available but are incorrect - i.e. not conforming to say the
          sls (subledger security). This may happen when a response is made
          through the email or the background process picks the wf up.
          This may happen due to the fact that the mailer / background process
          carries the context set by the notification/wf it processed last*/

          IF ( l_preserved_ctx = 'TRUE') THEN

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_USER_ID',
          avalue => l_responder_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_RESP_ID',
          avalue => l_session_resp_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_APPL_ID',
          avalue => l_session_appl_id);
          ELSE

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_USER_ID',
          avalue => l_responder_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_RESP_ID',
          avalue => l_preparer_resp_id);

          PO_WF_UTIL_PKG.SetItemAttrNumber(itemtype=>itemtype,
          itemkey => itemkey,
          aname => 'RESPONDER_APPL_ID',
          avalue => l_preparer_appl_id);

          END IF; -- ( l_preserved_ctx = 'TRUE')

          END IF; --(l_session_resp_id is null)

          END IF; --(l_responder_id <> l_session_user_id)

          END IF; -- (l_responder_id is not null)

          So I have to create custom code to bypass this logic..