Documentation for the parameters in the PDF_REPORT_CREATED event | IFS Community
Question

Documentation for the parameters in the PDF_REPORT_CREATED event


Userlevel 6
Badge +14

Hi all,

I am trying to activate an event action that send the report “Customer Statement of Account” to the customers email address. But I am having a hard time getting it to work. All the parameters starting with pdf_ are blank.

 

Is there any documentation for the parameters?


This topic has been closed for comments

11 replies

Userlevel 6
Badge +14

Sort of..

I could not find a way to alter the content of the e-mail generated by “order report” or prevent it from sending the email.

Instead I made an event that sends out one more email to the customer. The results is that the employed ordering the report will receive 2 emails. The standard email from the system and a copy of the email going to the customer (this way the employee can see that the email was actually send to the customer.)

The code is a little complex, but here it is. Fill free to use it or ask questions. 

 

declare

print_job_id_ number;
settings_ varchar(32000);
send_pdf_to_ varchar2(2000);
xml_ clob;
x_ xmltype;
customer_id_ varchar2(2000);
to_user_name_ varchar2(2000);
from_user_name_ varchar2(2000);
subject_ varchar2(32000);
text_ varchar2(32000);
lang_ varchar2(10);

begin

select '&PRINT_JOB_ID' into print_job_id_ from dual;

select job.settings into settings_ from print_job job where job.print_job_id=print_job_id_;

Message_Sys.Get_Attribute(settings_, 'SEND_PDF_TO', send_pdf_to_);

select x.data into xml_ from xml_report_data x where x.result_key= '&RESULT_KEY';

x_:= xmltype.createxml(xml_);

select extractvalue(x_, '/CUST_STMT_ACCT_REP/CUSTOMERS/CUSTOMER/CUSTOMER_NO') into customer_id_ from dual;

select listagg(distinct value, ';') within group (order by value) into to_user_name_ from
(
select value
from customer_info_contact_cfv con inner join person_info_comm_method2 m on con.person_id = m.identity
where con.customer_id=customer_id_ and m.method_id_db= 'E_MAIL' and con.cf$_receive_account_state_db= 'TRUE'
union
select value
from COMM_METHOD_cfv c where c.identity =customer_id_ and c.PARTY_TYPE_DB='CUSTOMER' and c.method_id_db= 'E_MAIL' and c.cf$_receive_account_state_db= 'TRUE'
) t;

if (to_user_name_!=';') then
to_user_name_:= to_user_name_ ||';'|| send_pdf_to_;

select customer_info_api.Get_Default_Language_Db(customer_id_) into lang_ from dual;

if (lang_= 'da') then
subject_ := 'Kontoudtog';
text_ := 'Vedhæftet fremsendes seneste kontoudtog. Spørgsmål bedes rettet til undertegnede.' ||chr(10)||chr(13);
text_ := text_ || 'Merethe Hviid Bonde' ||chr(10);
text_ := text_ || 'Regnskabsassistent' ||chr(10);
text_ := text_ || '25 66 00 60' ||chr(10);
text_ := text_ || 'mhb@induflex.dk' ||chr(10)||chr(13)||chr(10)||chr(13);
text_ := text_ || 'Venlig hilsen' ||chr(10)||chr(13);
text_ := text_ || 'Induflex A/S' ||chr(9)||chr(9);
text_ := text_ || '98 37 19 88' ||chr(10);
text_ := text_ || 'Hagensvej 25' ||chr(9)||chr(9);
text_ := text_ || 'induflex@induflex.dk' ||chr(10);
text_ := text_ || '9530 Støvring' ||chr(9)||chr(9);
text_ := text_ || 'induflex.dk';
else
subject_ := 'Statement of Account';
text_ := 'Statement of Account attached. Questions can be addressed to:' ||chr(10)||chr(13);
text_ := text_ || 'Merethe Hviid Bonde' ||chr(10);
text_ := text_ || 'Accounting Assistant' ||chr(10);
text_ := text_ || '+45 25 66 00 60' ||chr(10);
text_ := text_ || 'mhb@induflex.dk' ||chr(10)||chr(13)||chr(10)||chr(13);
text_ := text_ || 'Best regards' ||chr(10)||chr(13);
text_ := text_ || 'Induflex A/S' ||chr(9)||chr(9);
text_ := text_ || '+45 98 37 19 88' ||chr(10);
text_ := text_ || 'Hagensvej 25' ||chr(9)||chr(9);
text_ := text_ || 'induflex@induflex.dk' ||chr(10);
text_ := text_ || '9530 Støvring' ||chr(9)||chr(9);
text_ := text_ || 'induflex.dk' ||chr(10);
text_ := text_ || 'Denmark';
end if;

Command_SYS.Mail
(
from_user_name_ => from_user_name_,
to_user_name_ => to_user_name_,
text_ => text_,
subject_ => subject_ ,
attach_ => '&PDF_FILE'
);
end if;

end;

 

Userlevel 6
Badge +14

@Imal Thiunuwan ,

Yes I have. 

To my understanding, the pdf parameters are set through application code (most be IEE in this case). I therefore presumed that some of them had values. They are all empty.

I probably overlooksomething obvious.

Userlevel 6
Badge +14

@Imal Thiunuwan, Thanks for your replay.

I did look at this. I can do this:

pdf_report_event_param_api.New_Parameter('CUST_STMT_ACCT_REP', 'PDF_PARAMETER_1', 'STRING', 'mail@company.dk');

But that is default value. For each customer, I need a different email. 

 

Userlevel 6
Badge +14

Hello @Hans Andersen ,

Thank you for the information. Could you please check below community post? Not sure if it answers your question. But worth to check it.

Also you can use a cursor with custom logic like below to get the emails and use PDF_REPORT_CREATED event to send out the pdf file.

DECLARE

  email_ VARCHAR2(200);

  CURSOR get_email IS
    SELECT email 
    FROM <...> 
    WHERE <...>;

BEGIN
  
IF <validation to run for the desired report>
  OPEN get_email;
  FETCH get_email
    INTO email_;
  CLOSE get_email;

  command_sys.mail(<from_user>,
                   email_,
                   <subject>,
                   <text>,
                   attach_ => '&PDF_FILE');
                   
END IF;
END;

=========================================================================

Also, Following is a code sample how to set event params in PDF_REPORT_CREATED event

DECLARE
send_pdf_info_ VARCHAR2(4000);
BEGIN

send_pdf_info_ := Message_SYS.Construct('PDF');
Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_1',CUSTOMER_EMAIL);
...
Client_SYS.Add_To_Attr('SETTINGS', send_pdf_info_, print_job_attr_);
Print_Job_API.New(print_job_id_, print_job_attr_);

END;

 

Now you should be able to access the email from PDF_PARAMETER_1 of the event.

Cheers!

Badge +12

Hello @Hans Andersen,

I’m also having the same problem, were you able to solve this issue ?

 

Thank you.

Badge +12

@Hans Andersen 

Thank you for sharing the code.

I will try this :slight_smile:

 

Thank you again.

Userlevel 6
Badge +14

Hello @Hans Andersen ,

Have you checked the F1documentation page which I have attached below as a document?

 

Cheers!

Userlevel 6
Badge +14

Hello @Hans Andersen ,

 

Yes, the pdf_parameters are set by the code.  The thing is that you will have to create separate event actions for each report that you want to send emails. You can change the values for the conditions by using the “Conditions for performing this action” option. Also, the parameter values can be assigned as mentioned in the F1Doc like below.

Defining default values for event parameters of the above PDF_REPORT_CREATED event can be done in Report Definition file (.rdf) of each report. Default values for PDF_PARAMETER_1 to PDF_PARAMETER_10 can be defined this way using interface in PdfReportEventParam logical unit.

You can set values as per your choice by using the above mentioned method or add conditions as mentioned in the f1 documentation.

Hope this helps.

Cheers!

Userlevel 1
Badge +5

@Imal Thiunuwan

Thank you so much for the code above

It works for PDF_PARAM_1 but for some reason not for PARAM 5 and 6.

send_pdf_info_ := Message_SYS.Construct('PDF');

Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_1','&VENDOR_MAIL_ADDRESS');
Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_5','&BUYER_MAIL_ADDRESS');
Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_6','&ORDER_NO');
 

best regards

Dominik

This above was not working at all, not just for PARAM_1 but all PARAMETERS. it did not pass on any values to the PDF_REPORT_CREATED event. 

Userlevel 6
Badge +14

@Imal Thiunuwan

Thanks for the link. Unfortunate, this is when there IS data in a pdf_parameter. In our case they are all empty.

We might have to do some coding as you suggest. It just puzzles me that it should be necessary. I have a feeling that something is wrong in our setup.

Userlevel 1
Badge +5

@Imal Thiunuwan 

Thank you so much for the code above

It works for PDF_PARAM_1 but for some reason not for PARAM 5 and 6.

send_pdf_info_ := Message_SYS.Construct('PDF');

Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_1','&VENDOR_MAIL_ADDRESS');
Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_5','&BUYER_MAIL_ADDRESS');
Message_SYS.Add_Attribute(send_pdf_info_, 'PDF_EVENT_PARAM_6','&ORDER_NO');
 

best regards

Dominik