Hello,
(New to APEX so apologies in advance for any misuse of Oracle terms)
I'm having some trouble building a certain functionality into an application page I am developing. Basically my setup is that USER1 can fill out a form using various page items, these items store the input as something similar to :P2_ITEM_1, :P2_Item_2, etc. These items are then used in a Dynamic Action executing a PL/SQL code (APEX_MAIL.send) to send employees a notification email that a new form was filled out. One of the items :P2_CHECKBOX) is a checkbox, built from an LOV of email addresses.
I would like to have a setup where USER1 selects the checkbox to decide who will receive the notification email. I believe that when USER1 makes his selection the data for P2_CHECKBOX is stored as a string equal to 'employee1@mail.com:employee2@mail.com:employee3@mail.com' (colon delimited string).
To send an email to multiple recipients with APEX_MAIL.send the formatting should be p_to => 'employee1@mail.com', 'employee2@mail.com', 'employee3@mail.com',
I am trying to change the :P2_Checkbox value to a string which allows an email to be sent to multiple email accounts. If I use a radio group to only allow one email address selection the code runs fine and the person selected receives the notification email so I am pretty sure it just has to do with having multiple selection, not another part of the code.
Ideally the line p_to => :P2_Checkbox, would be the end result where employees 1, 2, and 3 all receive the same email thread.
So far I have tried replacing the colon with ', ' to mimic the 'employee1@mail.com', 'employee2@mail.com', 'employee3@mail.com', string necessary by using a SetValue Dynamic Action with Replace( :P2_Checkbox, ':', ''', '''). The extra apostrophes are to allow the actual apostrophe character to be placed in the string.
I also attempted to build a loop of nested substr/instr function to identify and extract the email addresses but that has proven too complex for me
Example:
APEX_MAIL.send (
p_to=> :P2_CHECKBOX,
...
p_body_html=> 'New notification from ' || P2_ITEM_1|| ' about '|| P2_ITEM_2,
...);