Earlier we have seen how to close FYI based notification. Here in this article lets see how to close Approval/Response based notification from backend.
Since its Approval/Response based notification, first we need to set the Response RESULT value using API wf_notification.setattrtext and then close notification by responding to it using API wf_notification.respond.
Syntax
--
--Setting 'RESULT' value
--
wf_notification.setattrtext
(nid => p_notification_id,
aname => 'RESULT',
avalue => p_result_value);
--
--Responding to the Notification
--
wf_notification.respond
(nid => p_notification_id,
respond_comment => 'RESULT',
responder => p_result_value);
Example
BEGIN
--
--Setting 'RESULT' value
--
wf_notification.setattrtext (nid => '4754620', --Notification ID
aname => 'RESULT', --This is a constant value, will always be same
avalue => 'APPROVED' --This value can be anything, depends on your workflow
);
--
--Responding to the Notification
--
wf_notification.respond (nid => '4754620', --Notification ID
respond_comment => 'Approved From backend', --This can be any user comment
responder => 'STHALLAM' --user name who responds
);
COMMIT;
END;
Points to Note:
- aname will always be ‘RESULT‘
- avalue can be anything depending upon the Action resultant value configured in the workflow definition