How to trigger mail with Payment Voucher report attachment on posting the Payment entry

By | July 28, 2023

In Sage X3, we recently had a requirement to configure an email to be triggered to send the Payment Voucher report as an attachment on posting the Payment entry to the respective supplier against whom the Payment entry has been created.

So let’s see how we can create and configure an email.

Step 1: Deploy the report.

Step 2: Create the report code Ex: ZIAPPAYVOCHR1 for the report and set the destination as Email and tick the Mandatory check box.

New Stuff: Multiple grid lines selection & operation in Sage X3

Fig 1: Report Dictionary
Fig 1: Report Dictionary

Step 3: Now we need to write a script to get the mail address of each supplier and to do so we will write a script on the AVANTBOUT action of SPEPAY to fetch the supplier’s mail and store it in a global variable.

Step 4: To print the report we will write a script on the AVANTBOUT action of SPEPAY (As we are not sending mail while printing the report, it will trigger on posting the entry So we have to add code to print the report).

Now let’s create a workflow for this report.

Step 5: To create a workflow (Ex: ZPAYVOCHR1) go to Setup->Workflow->Workflow Rules.

Set the event code to ARP and in the Conditions tab, select Type as Header and in the conditions, [F:ARP]RPTCOD=”Report code”

Ex: [F:ARP]RPTCOD=”ZIAPPAYVOCHR1

Fig 2: Workflow Rules
Fig 2: Workflow Rules

Step 6: Now in the Recipient put the Global variable that contains the mail id of the supplier. Here in our case the Global variable was “ZSUPPMAIL1“.

Fig 3: Recipientp
Fig 3: Recipient

Now, once a Payment entry is Posted a mail will be triggered that will send the report to all the suppliers in the Payment. In this way we can trigger an email to all the suppliers in Payment entry.