Attaching Multiple Documents to a Notification Email

 DocJuris’ auxiliary Flows are pre-defined templates of complex actions that you can import to your environment and use as a black box, meaning that the complex actions are hidden and centralized. This allows you to:

  1. Perform complex actions without being concerned about how they work.
  2. Centralise standard practices so that you can re-use them in all your Flows.
  3. Use them and take advantage of DocJuris’ expertise and speed up your Flow development

If you’re starting with Power Automate, you’ll want to check out our Overview of Power Automate guide.

 

Microsoft Forms is a great way to collect user feedback, including PDF or Excel files. Still, it would be great to have those files sent by email as a notification. This article will cover how to do this using DocJuris’ auxiliary Flows, in order to automate the task of getting the files from Microsoft Forms and then sending them as a notification.

 

Installation

Step 1: Install the DocJuris Auxiliary Flows as an imported solution

You can refer to Installing DocJuris' Auxiliary Flows for further information about initially installing auxiliary Flows. The article will explain what auxiliary Flows are and how to import them to your environment so you can use them efficiently.

Step 2: You must add the flow you're creating to the solution

First, create a flow and save it. Next, find DocJuris Auxiliary Flows under the Solutions tab. Click DocJuris Auxiliary Flows and then click "Add Existing" -> Automation -> Cloud flow. Pick the flow you're creating and add it to the solution.

 

Overview

The current Flow will help you transfer a list of attachments submitted via Microsoft Forms and add them as attachments in an email notification. As mentioned before, we’ll be using it as a “black box”, meaning that we’ll use an action to call and send the documents via email.

 

To demonstrate how it works, let’s look at a sample Microsoft Form that will collect the information from the User.

 

ContractInformation_SAM51.png

 

It’s a simple form; the key is that you can upload one or multiple documents and add all the questions you want your user to answer. The Flow will get all the information submitted in the form, not just the attachments, but for this article, we’ll focus on the attachments side of the Flow.

 

Find the Flow

As mentioned before, you must import the auxiliary Flow to your environment before using it. You can do this by following the instructions on Installing DocJuris' Auxiliary Flows.

 

You must use the “Run a Child Flow” action to run an auxiliary Flow. You can find that action in Power Automate and select “Built-in” followed by “Flows.”

 

BuiltInFlows_page2_SAM51.png

 

You can then find the “Run a Child Flow” action.

 

RunaChildFlow_SAM51.png

 

Here’s what it looks like:

 

RunaChildFlow_dropdown_SAM51.png

 

After pressing the dropdown, search for the auxiliary Flow by selecting it from the dropdown.

 

Screenshot_2022-09-07_at_15_24_44.png

 

The “Child Flow” field will contain the name you defined at the time of import. Your name might be different than the one in the example above.

 

The auxiliary Flow’s fields

Now that we found the Flow, let’s check each field we need to provide. All fields are required.

 

Note: The Flow is designed to send an email with all attachments to all recipients. Therefore, if you want to send multiple emails with just a subset of recipients, for example, you need to build other “Run a Child Flow” action calls with the corresponding fields.

 

Likewise, if you want to separate the attachments per email, then you need to parse the “attachments” field to contain only the files you want to be inserted. We strongly recommend not doing this, since any mistake in parsing the “attachments” field may result in the auxiliary Flow not working, so proceed with caution.

 

Attachments

Since we want to insert Microsoft Forms attachments, it’s only logical that we’ll start with them. To fill in this field, you only need to provide the raw value you get from Microsoft Forms.

 

You can use the “Get response details” action as follows:

 

Screenshot_2022-09-07_at_15_31_23.png

 

Depending on your Microsoft Forms, the name presented may be different. Notice that the form’s name is the same as displayed in Power Automate.

 

DocJuris002_ContractInformation.png

 

Here’s what it looks like in Power Automate:

 

Screenshot_2022-09-07_at_15_31_23_2.png

There’s no configuration, conversion, or parsing needed. You can provide the value “as-is,” and DocJuris will take care of the rest.

 

Email To

Now that we have the attachments to load, we need recipients to send them to.

 

Note that when you imported the auxiliary Flow, you needed to map it to a user in your tenant (when you defined the connection). This means that the User you’ve authorized the connection to will be the user that will be used to send the email. The recipients will see it as any other email sent, so be aware of this. If you want the email’s sender to be someone else, you must re-import the Flow with authorization to send the email from the alternative’s user account.

 

Since we may send the emails to multiple people, we need to separate them using a semicolon, like:

 

email@docjuris.com; email2@docjuris.com

 

You can also add spaces between the email addresses in order to make them more visible. It won’t interfere with the way the email will be sent.

 

Screenshot_2022-09-07_at_15_41_18.png

Please note that the DocJuris system won’t do any validation of the syntax of the emails. We’ll use the “Email to” field “as-is” to send the email, so please be sure that the emails are correct.

 

You can also send emails to anyone, even outside your organization, as long as the email exists. Be careful when inserting emails here because you could inadvertently be sending proprietary information outside your organization.

 

As mentioned before, all attachments will be added to a single email that will be sent to all recipients, so keep this in mind when filling in the field.

 

Power Automate won’t break if the email is valid but doesn’t exist. Still, the account configured to send the emails will probably receive an error message indicating that the email was not delivered.

 

Email CC

This field will behave the same as the “Email To” field. The emails inserted here will appear in the CC field in the email the same way as when they were added when sending an email from your email client. All the previous warnings and rules also apply here.

 

Screenshot_2022-09-07_at_15_54_19.png

 

As before, we’ll only send one email to all recipients simultaneously; if you’re sending emails outside your organization, please be careful not to include sensitive email addresses you want to keep private. All fields will be visible to all recipients of the email.

 

Email Subject

Next, we’ll fill out the Email Subject field. The email’s subject will appear as if you were sending it from an email provider like Outlook. Please keep this field short since it will be included in the “subject” field of the email. Also, this field can be built dynamically, meaning you can use fields from the Form to build the send email.

 

Here’s an example:

 

Screenshot_2022-09-07_at_15_55_45.png

 

Finally, this is a text field, meaning there’s no formatting possible.

 

Email Body

Finally, we need to provide an Email Body to send in the email. The email body will be analogous to the email body of your email client of choice. As with any of the previous fields, it can be built dynamically, meaning that you can provide values in variables or any value of earlier actions of the Flow.

 

Screenshot_2022-09-07_at_16_00_29.png

 

DocJuris will do its best to send the email so it’s presented correctly, but we cannot ensure that all email clients will render the information accurately. This is a limitation of the email client itself and not DocJuris’ auxiliary Flow or Power Automate itself, since different email clients parse the same information differently.

 

DocJuris’ auxiliary Flow will add line breaks, detect links in the email, and add the corresponding code to display the email correctly. This way, if you include a link, the people who receive the email can click it without copying and pasting the URL. Other customizations need to be done manually by adding the HTML fields in the “Email Body” field text.

 

For example, you can customize the text by adding  <strong>this will bold the text<strong> or <i>this will make the text italic</i> for text in bold and italic respectfully.

 

You can use this strategy even for dynamic fields as follows:

Screenshot_2022-09-07_at_16_10_20.png

 

Unfortunately, we cannot provide a WYSIWYG screen per the limitation of Power Automate, so all formatting needs to be done manually, except for links or line breaks that DocJuris’ auxiliary Flow will take care of automatically.