Notifications for your Feedback
I find that using the Feedback functionality on APEX is just perfect when users are testing and reviewing your work on a dev or test environment.
It’s incredibly easy to setup. Add a new page of type “Feedback Page”. Select the page number you want for this new page. The wizard allows you to create a Feedback Navigation Bar Entry and, while you’re there, enable feedback for your application for good measure.
At this point you’re done! A brand new page is created and a “special” Navigation Bar Entry is added. I say special because when you disable Feedback for your application (Application Properties -> Allow Feedback) the Nav Bar Entry goes away.
Feedback entries are added as part of Team Development for later review. But…
My problem with Feedback; I rarely know that it’s there!
I have gone days before I noticed someone added a new Feedback entry. Then the user asks… “what do you think about the issue I reported”. Enter blank stare.
To “solve” this, I like to add a little snippet of code using apex_mail to make people in the project aware of the new entry by sending out an email regarding the new Feedback entry.
If you look at the Feedback page, there’s a process in there “Submit Feedback”:
apex_util.submit_feedback ( p_comment => :P900_FEEDBACK, p_type => :P900_FEEDBACK_TYPE, p_application_id => :P900_APPLICATION_ID, p_page_id => :P900_PAGE_ID, p_email => null);
I like to change it to something like this:
declare l_to app_parameters.value%TYPE; l_from varchar2(200); g_email_prefix app_parameters.value%TYPE; l_body clob; l_subject varchar2(200); i number; begin apex_util.submit_feedback ( p_comment => :P900_FEEDBACK, p_type => :P900_FEEDBACK_TYPE, p_application_id => :P900_APPLICATION_ID, p_page_id => :P900_PAGE_ID, p_email => null); l_to := app_util.get_param('FEEDBACK_EMAIL'); l_from := nvl(app_util.get_email(:APP_USER), 'firstname.lastname@example.org'); g_email_prefix := app_util.get_param('EMAIL_PREFIX'); l_body := 'New feedback for page: ' || :P900_PAGE_ID || utl_tcp.crlf || 'From: ' || :APP_USER || utl_tcp.crlf || utl_tcp.crlf || :P900_FEEDBACK || utl_tcp.crlf; i := instr(:P900_FEEDBACK, chr(10)); if i = 0 or i > 80 then -- if the first line entered is too long or it's all in one line -- then grab the first 90 charachters entered by the user i := 90; end if; l_subject := g_email_prefix || 'Feedback: ' || substr(:P900_FEEDBACK, 1, i); apex_mail.send(p_to => l_to , p_from => l_from , p_subj => l_subject , p_body => l_body); end;
The call to get_param(‘FEEDBACK_EMAIL’) returns a comma delimited list of all the emails that need to be notified. The get_param(‘EMAIL_PREFIX’) is used to be a good netcitizen and make it easy for people to filter these emails out. I usually set it to the Short App Name + DEV or TEST.
The email itself will include everything that was typed in by the user in the Feedback textarea. However, the Subject will be the first line typed or the first 90 characters.
See as long as you keep calling apex_util.submit_feedback to record the feedback, you can do anything you want. You could even send the feedback entry to some other tracking system and skip the call to apex_util.submit_feeback all together.