Validating notification response
I received a requirement from one of my
clients to force the user(approver) to enter the comments value before approving
the notification..This notification contains 2 responses (1. Approve, 2.
Reject), so when the approver rejects the notification we need to make the
Comments field in the notification as mandatatory and the notification should
not go to the next stage untill he/she enters the comments field before clicking
the Reject button in the workflow notification.
Fix: To implement this we need to write a Post notification function which validates the response and checks whether there is a value included in the response attribute. This post notification function needs to be placed in the workflow package and we need to call it the pl/sql block of the notification.
The code in the Post notification function would looks like this.
Fix: To implement this we need to write a Post notification function which validates the response and checks whether there is a value included in the response attribute. This post notification function needs to be placed in the workflow package and we need to call it the pl/sql block of the notification.
The code in the Post notification function would looks like this.
--------------------------------------------------------------------
PROCEDURE set_reject_comment (
itemtype IN
VARCHAR2,
itemkey IN
VARCHAR2,
actid IN
NUMBER,
funcmode IN
VARCHAR2,
resultout OUT
VARCHAR2
)
IS
v_response VARCHAR2 (2000);
l_user_comment VARCHAR2 (2000);
approval_comment EXCEPTION;
BEGIN
/*===================================================================================
This will derive the button
by looking at the response from the notification. the WF_ENGINE.CONTEXT_NID
variable will tell you the notification ID that is being responded to, and we
can derive the response from there.
====================================================================================*/
v_response :=
wf_notification.getattrtext
(wf_engine.context_nid, 'RESULT');
/*===================================================================================
This will retrieve the value
which is stored in the Approval Comments field by the approver when the reject
button is pressed.
====================================================================================*/
l_user_comment :=
wf_notification.getattrtext
(wf_engine.context_nid,
'APPROVAL_COMMENT'
);
/*===================================================================================
This block will be fired when
the user has pressed the 'Reject' Button and the comments is null and then it
will raise the user defined error. And the workflow will not continue untill
the user enters value in the comments field for rejection.
===================================================================================*/
BEGIN
IF ( funcmode = 'RESPOND'
AND v_response = 'REJECTED'
AND l_user_comment IS NULL
)
THEN
RAISE approval_comment;
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.'
);
RAISE;
END;
COMMIT;
END set_reject_comment;
--------------------------------------------------------------------
Thanks a lot!
ReplyDeleteHi, can you please let me know, how to implement this function SOA?
ReplyDeleteThis content is written very well. Your use of formatting when making your points makes your observations very clear and easy to understand. Thank you.
ReplyDeletefortnite account generator free
ReplyDeleteMy name is Leah Brown, I'm a happy woman today? I told myself that any loan lender that could change my life and that of my family after having been scammed separately by these online loan lenders, I will refer to anyone who is looking for loan for them. It gave me and my family happiness, although at first I had a hard time trusting him because of my experiences with past loan lenders, I needed a loan of $300,000.00 to start my life everywhere as single mother with 2 children, I met this honest and God fearing online loan lender Gain Credit Loan who helped me with a $300,000.00 loan, working with a loan company Good reputation. If you are in need of a loan and you are 100% sure of paying the loan please contact (gaincreditloan1@gmail.com)
ReplyDeleteYou can't believe what i just got,… A loan of $ 60,000. I have been looking for a loan for the past 2years until i was referred to a legitimate lender. Though it was not that easy to approve my loan, as you know nothing good comes easy. But I got my loan within 4 hours i got my loan, and before i knew it, the loan was transferred to me. please friends, don't let any body deceive you and scam you for this is real. Contact them via Email: gaincreditloan1@gmail.com OR You can also whatsApp them at: at +1-(901)676-0641 (WhatsApp Only)
ReplyDeleteMy spouse and I love your blog and find almost all of your posts to be just what I’m looking for. Appreciating the persistence you put into your blog and the detailed information you provide. I found another one blog like you Oracle Cloud Infrastructure .Actually I was looking for the same information on internet for Oracle Cloud Infrastructure and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.