Getting Started with Salesforce Quick Action APIs – Part 3 (Email Action with file attachment)

This is in continuation of previous posts on Salesforce Action APIs. For previous posts refer to this link Getting Started with Quick Action APIs

This Quick Action APIs – Part 3 where we will focus on how to set email action fields value especially Attachments/Content documents.

For this, we are building a scenario where using the visualforce page a PDF will be generated and the same PDF needs to be sent out to the customer using "Send Email" Quick Action.

Steps will be the following:
  • Create a simple visualforce page using the standard controller of "Quote" object named "QuotePDF"
  • Embed the "QuotePDF" in lightning Component using an iframe for preview.
  • Upon iframe, Load saves the PDF under the current Quote record as Content Document and return content document id.
  • Now pass this Content Document ID array under the "ContentDocumentIds" attribute of setActionFieldValues funtion of Quick Action APIs.
Note: For Quick Action APIs to work the requested component should be present on the record current screen from where this action will invoke else system will through error ☹️

The key points to consider:

  • ContentDocumentIds: This accepts an array of Content Document Ids so in case multiple files need to attach under email than it will be possible.

Comments

Popular posts from this blog

Getting Started with Salesforce Quick Action APIs – Part 2 (Automatically populate fields with custom data values)

Getting Started with Salesforce Quick Action APIs – Part 4 (Email Action with email template)

Getting Started with Salesforce Quick Action APIs – Part 1 (Invoke using custom button)