Send Record Template as an Attachment in Mail

Send Record Template as an Attachment in Mail

Requirement

Send a record summary as a PDF attachment via mail using the Deluge's send mail task.

Use Case

Consider an organization using Zoho Creator to manage POS operations. Whenever an invoice is generated, the invoice record template is promptly emailed to the customer as a PDF attachment.

See how it works

Steps to Follow

  1. Create a form according to your preferences to collect invoice details. In this tutorial, for demonstration purposes, we have used the 'Pay an Invoice' form from the form template.

  2. Navigate to Record Templates in the application settings and Create a record template by selecting the Pay an Invoice form. Name the template 'Invoice'.

  3. Design your record template by dragging and dropping the required elements and fields for your template from the designer, as shown below.

  4. Create a workflow to execute on the successful submission of the Pay an Invoice form, then select the Record Event as 'Created'. Name the workflow 'Send Mail' and click Create Workflow. This workflow will send the invoice to the customer's email and store it in the Email field.

  5. Click Add New Action > Deluge Script and add the following code to the Deluge editor.
  1. //Mail the invoice record template as a PDF attachment to the customer using the Deluge send mail task.
  2. sendmail
  3. [
  4.  from :zoho.adminuserid
  5.  to :input.Email
  6.  subject :"Zylker - Your invoice as on" + input.Date_field
  7.  message :"Dear " + input.Name + ", <br />Thank you for your recent purchase with Zylker. Attached, you will find the invoice for your transaction.<br /> <br />Best Regards <br />Zylker Corp"
  8.  Attachments :template:Invoice as PDF
  9. ]
Where,

Invoice

Represents the link name of the record template can be found in the record template properties.

See How it Works


  1. Send Mail Task
  2. Understand record templates