Forum Stats

  • 3,768,284 Users
  • 2,252,770 Discussions
  • 7,874,514 Comments

Discussions

Page URL not formatted properly to use in email?

hayatms
hayatms Member Posts: 58 Blue Ribbon

Hi,

I am trying to create and send URL from apex.oracle.com but seems there is some problem in the created URL,

SELECT apex_mail.get_instance_url || APEX_UTIL.PREPARE_URL(p_url => 'f?p=' || v('APP_ID') || ':13:'|| v('APP_PAGE_ID') ||'::NO::P13_ID:1') into v_PAGE_URL FROM DUAL;


  apex_mail.send (

    p_to         => '[email protected]',

    p_template_static_id => 'JOB_REQUISITION',

    p_placeholders    => '{' ||

    '  "ORDER_NUMBER":'      || apex_json.stringify( 'l_business_ref' ) ||

    '  ,"CUSTOMER_NAME":'      || apex_json.stringify( 'some_value' ) ||

    '  ,"MY_APPLICATION_LINK":'   || apex_json.stringify(v_PAGE_URL) ||

    '  ,"ORDER_URL":'        || apex_json.stringify( 'some_value' ) ||

    '}' );

No idea why pls/apex//pls/apex is duplicated in the output URL? APEX version is 21.2 and it is apex.oracle.com

Tagged:

Answers

  • msammour
    msammour Member Posts: 59 Bronze Badge

    Can you check what [apex_mail.get_instance_url] will return, if the returned URL is having pls/apex then you can remove it from:

    Manage Instance \ Instance Settings \ Email \ Application Express Instance URL

  • hayatms
    hayatms Member Posts: 58 Blue Ribbon

    Hi,

    I was looking for such options but was unable to find them in apex.oracle.com as seems instance settings can't be accessed or maybe I am missing the navigation. thanks

  • InoL
    InoL Member Posts: 9,326 Gold Crown

    This could very well be a bug with friendly URLs.

    apex_mail.get_instance_url returns https://apex.oracle.com/pls/apex/

    APEX_PAGE.GET_URL or APEX_UTIL.PREPARE_URL as non-friendly URL returns f?p=...

    So, if you combine these two, it works as expected.

  • hayatms
    hayatms Member Posts: 58 Blue Ribbon
    Hi,
    I tried all these options but these both are prefixing /pls/apex which is causing problem. I tried 
    SELECT APEX_PAGE.GET_URL (
                p_page   => 1,
                p_items  => 'P1_X,P1_Y',
                p_values => 'somevalue,othervalue' ) f_url_1,
             APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:1:&APP_SESSION.::::P1_X,P1_Y:somevalue,othervalue')
         FROM DUAL
    

    When I am trying following in SQL using SQL Commands then URL is correct but same code when I am trying in APEX form using processes or pl_sql having the problem,


    SELECT apex_mail.get_instance_url || APEX_PAGE.GET_URL (p_page  => 13, p_items => 'P13_ID',p_values => 1 ) 

    FROM DUAL;


    I need to send this URL in email so the user will click to open the form. Any suggestions please to get resolved on apex.oracle.com.

  • msammour
    msammour Member Posts: 59 Bronze Badge

    If you cannot access the internal admin console you cannot do it, [APEX_PAGE.GET_URL, and APEX_UTIL.PREPARE_URL] will always return the full path.

    For your case you can add <a href=""> in your email body and the href source will be something like:

    SELECT APEX_MAIL.GET_INSTANCE_URL || 'f?p=' || V('APP_ID') || ':13:' || V('APP_PAGE_ID') ||
           '::NO::P13_ID:1'
    FROM   DUAL;