Overview of the Flow
This flow is triggered on the update of a record (Account in our case), it then creates an E-mail using the “Create new Record” step from the common data services connector. Afterwards we are using our DocumentsCorePack custom connector to create an e-mail body from a DCP Template and attach it to the e-mail. Then we create an e-mail attachment and attach it to the same e-mail. The last step finally sends the e-mail.
When you create a new flow, you have to decide which action will trigger the flow. In our case we have simply added a trigger on the update of the Account.
2. Create E-mail
In the second step we create an E-mail Message, you can leave the sender, recipient and regarding empty for now, as our DocumentsCorePack custom connector offers a very easy way to fill them later. You can still already fill the Subject and Description to your liking.
3. Create E-mail Body
To create the E-mail Body, we are using the DocumentsCorePack custom connector and choose the step “Create Document Job (sync)”. In this step it is mandatory to specify a template which shall be used to create the e-mail body, and an Entity ID with which the Template shall be merged.
Please note: The template needs to be created for the Entity Type specified in the E-mail ID.
To create the E-mail Body we must choose the Filetype “HTML”.
4. Attach E-mail Body
After creating the E-mail Body, we need to attach it to the E-mail. For this we select the Document that was created in the previous Create E-mail Body step, this can be found under “Document (Base 64 Encoded)”. We also take the Filename from the previous step and the E-mail Message from the Create E-mail step.
Here you can see what the “Document (Base 64 Encoded)” looks like:
5. Create Attachment
In this step we want to create an additional attachment that shall be attached to the final e-mail.
Again, we have to choose a Template, an Entity ID and an output FileType. As we want an attachment this time we are choosing “PDF”:
6. Attach Email Attachment
Again, we have to attach the created document to the email. This time we select the “Document (Base 64 Encoded)” and the Filename from the Create Attachment Step. Additionally, we also need to fill E-mail ID with the “E-mail Message” from the “Create E-mail “Step.
7. Send E-mail
Now that the E-mail Body and E-mail Attachment are attached to our E-mail, we want to finally send the e-mail. For the “E-mail To Send” we choose the “E-mail Message” from the Create E-mail step.
Based on the trigger you have chosen you can either use the “Owner” or “Modified By” user to get the current user, if you have a trigger that allows it you can also get the current user using the “User ID” from the dynamic values. This user can be specified as the sender of the e-mail. For Sender (Schema name) we choose the Entity Type “User”.
Now we also have an option to specify the “Regarding” of the E-mail, for this we used the Regarding (Id) “Account” and the Regarding (Schema Name) Entity Type “Account”.
For the To-Recipient we have chosen the To-ID “Primary Contact” and the To-Schema name Entity Type “Contact”.
To sum up: It is important that the “Schema name” points to the Entity Type of the ID that is specified.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to firstname.lastname@example.org