Solved

How to build the link to IFS from a custom code that send an email?

  • 10 November 2021
  • 4 replies
  • 153 views

Userlevel 6
Badge +8

Hello IFS community,

I have a code that sends an email to an user. 

From the IFS event, I know that I can create an event that sends an email and even create the link to the page in IFS using the rowkey by clicking “ADD URL” using the action type E_MAIL. 


See Screenshot 1 for more details about my question. 

 

Screenshot 1-

 

Code used to send the email - Screenshot 2

 

How could I add to the code (Screenshot 2) the way to generate the URL where the user can click on it from the email received and bring it to IFS, like it will work if I created the event using the IFS event action type E-MAIL (Screenshot1)?

Thanks,
JL

 

icon

Best answer by Manulak 10 November 2021, 17:43

View original

4 replies

Userlevel 3
Badge +8

Hi

Check archive module CALLC and procedure Cc_Case_Api.Send_Case_Mail maybe it helps You

 

Userlevel 3
Badge +4

@ZTC ZTC JGOTA  You need to format the email body as html, and use anchor to define the URL. That means, define the body parameter as a VARCHAR, and provide the html code of the desired email to that.

 

Example as below.

...

        url_ := <generate your URL here>;



        body_html_ := REPLACE(q'[<html>

                      <head>

                        <title>Emailing</title>

                      </head>

                      <body>Dear Sir, Madam<br>

                        <br>The report is ready.

                        <br>Log in : <a href=#URL#>Click here</a>

                        <br>

                      </body>

   </html>]’, #URL#, url_);

Command_SYS.Mail……….

 

Note : adjust the html as per your need

Userlevel 6
Badge +8

@Manulak Thanks for your example.

Could you please share with me a complete code? 

I can see your example is good.

Userlevel 3
Badge +4

Looks like you are trying to attach a report while sending the URL for the relevant IFS form as a URL.

So, assuming that you need to run a Customer Order report and send the email with the URL for that customer order, do the following.

  1. Create an event action against PDF_REPORT_CREATED
  2. Create the correct condition like REPORT_ID = CUSTOMER_ORDER_REP 
  3. Select type SQL
  4. Paste the following snippet and it should work when the PDF_PARAMETER_1 contains the related ORDER_NO and PDF_PARAMETER_2 contains the related recipient’s email address.

DECLARE

  order_no_  VARCHAR2(10000);

  pdf_       VARCHAR2(10000);

  receiver_  VARCHAR2(10000);

  url_       VARCHAR2(10000);

  subject_   VARCHAR2(10000);

  body_html_ VARCHAR2(10000);

  base_      VARCHAR2(10000);

BEGIN

  pdf_       := '&PDF_FILE'; 

  order_no_  := '&PDF_PARAMETER_1';

  receiver_  := '&PDF_PARAMETER_2';

  base_      := '<system_url>/client/runtime/Ifs.Fnd.Explorer.application?url=';

  url_       := base_ ||

                'ifsapf:frmCustomerOrder_Cust?EXTERNAL_SEARCH=ORDER_NO=' ||

                order_no_;

  subject_   := 'URL Test';

  body_html_ := REPLACE('<html>

  <head>

    <title>Emailing</title>

  </head>

  <body>Dear Sir, Madam<br>

    <br>The report is ready.

    <br>Order details - <a href=#URL#>Click here</a>

    <br>

  </body>

</html>', '#URL#', url_);

  Command_SYS.Mail(from_user_name_ => FND_SESSION_API.Get_Fnd_User,

                   to_user_name_   => receiver_,

                   text_           => body_html_,

                   attach_         => pdf_,

                   subject_        => subject_);

END;

 

 

Reply