Sunday, May 17, 2020

API to Approve or Reject a Workflow Notification from PLSQL (WF_NOTIFICATION.RESPOND & WF_NOTIFICATION.SETATTRTEXT)









                Below script will help you to approve or reject any workflow notification from backend

Tested Instance: R12

Script:

CREATE OR REPLACE FUNCTION xxwf_respond( pin_noitification_id IN NUMBER , piv_action IN VARCHAR2 ) RETURN VARCHAR2 IS lv_responser VARCHAR2(100); lv_comment VARCHAR2(1000) := 'Accept From Backend'; BEGIN SELECT recipient_role INTO lv_responser FROM wf_notifications WHERE notification_id = pin_noitification_id; -- ACCEPT/REJECT wf_notification.setattrtext (nid => pin_noitification_id, aname => 'RESULT', avalue => piv_action ); wf_notification.respond (nid => pin_noitification_id, respond_comment => lv_comment, responder => lv_responser ); COMMIT; RETURN 'Notification#' || pin_noitification_id ||' Successfully responded'; EXCEPTION WHEN OTHERS THEN RETURN 'Error: ' || SQLERRM; END xxwf_respond;


Test Script:
SET SERVEROUTPUT ON; DECLARE lv_message VARCHAR2(1000); BEGIN lv_message := xxwf_respond(2906485,'APPROVE'); DBMS_OUTPUT.put_line(lv_message); END;
SET SERVEROUTPUT ON; DECLARE lv_message VARCHAR2(1000); BEGIN lv_message := xxwf_respond(2906485,'REJECT'); DBMS_OUTPUT.put_line(lv_message); END;

0 Responses to “API to Approve or Reject a Workflow Notification from PLSQL (WF_NOTIFICATION.RESPOND & WF_NOTIFICATION.SETATTRTEXT)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.