Blog Archives

Workflow Validation while Rejecting the Notification

Requirement : To validate whether comments has been entered while rejecting. While Approving the notification the Validation is not Required.

Solution Approach : To write a Procedure and to call in Workflow Notification

There should be comments field in Workflow notification which will have attribute WF_NOTE. Here based on the value that we get we will Validate.

PROCEDURE Reason_not_null_validate (
p_itemtype IN VARCHAR2,
p_itemkey IN VARCHAR2,
p_actid IN NUMBER,
p_funcmode IN VARCHAR2,
x_resultout OUT NOCOPY VARCHAR2
)
–IS

IS
v_response VARCHAR2 (2000);
l_user_comment VARCHAR2 (2000);
approval_comment EXCEPTION;
BEGIN
IF ( p_funcmode = ‘RESPOND’) then
v_response :=
wf_notification.getattrtext (wf_engine.context_nid, ‘RESULT’);

l_user_comment :=
wf_notification.getattrtext (wf_engine.context_nid,’WF_NOTE’);

IF ( v_response = ‘REJECTED’AND l_user_comment IS NULL) THEN
RAISE approval_comment;
elsif(v_response = ‘REJECTED’AND l_user_comment IS not NULL) then
x_resultout :=’REJECTED’;
end if;
elsif(p_funcmode = ‘RESPOND’AND v_response = ‘APPROVED’)then
x_resultout :=’APPROVED’;
END IF;

EXCEPTION
WHEN approval_comment
THEN
raise_application_error
(-20010,
‘Approval Comment Field cannot be Null. Please enter reason for rejection and click reject.’
);
COMMIT;
END;

Design a site like this with WordPress.com
Get started