Question

PO print and send email

  • 7 February 2024
  • 10 replies
  • 144 views

Userlevel 3
Badge +10

I am wanting to capture and log where the email for a PO is being sent via the Purchase Order print from RMB menu.  What is the best way to do this please ?

 

 

 


10 replies

Userlevel 6
Badge +13

@JannetteC There is no direct method to capture the email addresses AFAIK.

You can try the following approach though.

Create an Event Action for Event PDF_REPORT_CREATED

This even is triggered when a PDF Report is created which is the case in your scenario (when sending the PO).

The Action Type could be selected as per your requirement. Typically can use Execute Online SQL to update a table using SQL. To capture the sender email address and PO number details, use PDF_FILE_SENT_TO and NOTES fields respectively and construct the SQL statement.

Or you can use any other type such as e-mail even. I hope you got the point.

Hope this helps !

Userlevel 3
Badge +10

Hi @Buddhika Kurera 

Thanks for your response.

 

What you suggested is what I did and it works well to update my custom table. 

I have also included code to rename the PO attachment and send the email.

The issue that I am now getting is that I am receiving 2 emails:

The renamed PO attachment email and the system generated email.
How do I stop the system generated email ??

 

Thanks in advance

Userlevel 7
Badge +20

Hi @Buddhika Kurera 

Thanks for your response.

 

What you suggested is what I did and it works well to update my custom table. 

I have also included code to rename the PO attachment and send the email.

The issue that I am now getting is that I am receiving 2 emails:

The renamed PO attachment email and the system generated email.
How do I stop the system generated email ??

 

Thanks in advance

 

Hi @JannetteC ,

 

Is your intension is to send the email through your custom logic without printing the report, and for that you use the Send E-mail checkbox to trigger the print job?

In that situation, you could use the Print option and select the Printer NO_PRINTOUT from the printer list. It will generate the PDF and trigger the PDF_REPORT_CREATED event and could avoid the additional email.

 

/Damith

Userlevel 3
Badge +10

Thanks @dsj 

What you have described is exactly what I am after.

How do I code the following ?

In that situation, you could use the Print option and select the Printer NO_PRINTOUT from the printer list. It will generate the PDF and trigger the PDF_REPORT_CREATED event and could avoid the additional email.

Userlevel 7
Badge +20

Thanks @dsj 

What you have described is exactly what I am after.

How do I code the following ?

In that situation, you could use the Print option and select the Printer NO_PRINTOUT from the printer list. It will generate the PDF and trigger the PDF_REPORT_CREATED event and could avoid the additional email.

 

The printer can be set as default depending on how the user prints the PO :)

If it’s printed using the print dialog, then Report rule is a better approach and for automatic printing, it’s possible to set the default printer in the Printer Definitions.

 

/Damith

 

Userlevel 3
Badge +10

Hi @dsj 

When I use the report rule route the email address was not available for me to update my custom table.

I am at a loss as to where to go with this now, I am a novice at this as you can probably tell.

Userlevel 7
Badge +20

Hi @dsj 

When I use the report rule route the email address was not available for me to update my custom table.

I am at a loss as to where to go with this now, I am a novice at this as you can probably tell.

email should be able to fetch from your code I guess.

Can you share your code? may be able to give you a hint ;)

Userlevel 3
Badge +10

Hi @dsj 

Code below:

 

Userlevel 7
Badge +20

Hi @JannetteC 

 

In PDF_REPORT_CREATED event, I hope you can get the user email from &USER_MAIL_ADDRESS attribute. Try if it works for you :)

 

/Damith

Userlevel 3
Badge +10

Hi @dsj,

 

Yes, that works - I am using the &PDF_FILE_SENT_TO attribute.

The issue that I am getting is that the user is getting two emails - the newly formatted one and the system default one.

Reply