Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL Block Mailto with window.location.href

TanPApr 12 2015 — edited Apr 12 2015

Hello, everyone!

I've been pulling my hair out for the last couple of days and would like to ask for your help, please.  So far, for the life of me, I can't seem get a value of a variable to pass into the body of the email.

I have a main APEX page (3).  Clicking on the Add button will call a JavaScript to open a modal window (page 260).  On page 260, based on some selected dropdown values, when user clicks on a Save button to save this record, I'd like to call up a MAILTO to open up an Outlook mail with some information in the subject line and the body. 

On page 260, I'm incorporating this new addition into an existing "On Submit: After Processing" branch (to PL/SQL Procedure):

DECLARE

    v_emp_count varchar(20);

BEGIN

SELECT COUNT (*)

     INTO v_emp_count

     FROM emp;

htp.p('<body>');

htp.p('<script type="text/javascript">');

htp.p('var obj = new Object();');

htp.p('obj.saved = "Y";');

htp.p('window.returnValue = obj;');

HTP.p('window.location.href=''mailto:me@meeeeeee.com?subject=Good day.&body=Count is '+v_emp_count+';');

htp.p('window.close(this);');

htp.p('</script>');

htp.p('</body>');

END;

The above code now gives me "Error processing branch.  ORA-06502: PL/SQL: numeric or value error: character to number conversion error."


When I had an Alert in there, the alert line seemed to work okay -- htp.p('alert(''v_emp_count is '||v_emp_count||' number.'');');


Page 260 does not contain all of the data I'd like to include in the email body.  My plan is just to get some value (from the SELECT statement) to show up and get the workflow working first.


I could get Outlook email window to show up with this line, but I'd like to get some value from the SELECT statement to show up.

HTP.p('window.location.href=''mailto:me@meeeeeee.com?subject=Good day.&body=Project_id is &P260_INSP_STATUS_IND.'';');


I've tried various ways, trying to get a variable from the SELECT to show up in the body of the email.  No luck, so far.  :-(

PLEASE help!!!!!!

Thank you!!!!!!

This post has been answered by Scott Wesley on Apr 12 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2015
Added on Apr 12 2015
4 comments
1,389 views