Getting SharePoint Site and List Details via ‘For a Selected File’ Power Automate Trigger 

The “For a selected file” trigger in SharePoint Power Automate lets you start automated Power Automate flow right from a file you pick in a SharePoint library. These flows can do things like send alerts, update info, move files, or approve documents.

But to customize better, you need more info, like the Site URL and List details.

When this trigger kicks in, it gives you two main things: the file’s web link and its name. From the web link, you can figure out the SharePoint Site URL and the Document Library name.

The SharePoint Site URL and Document Library name are important because most actions in Power Automate need them to work. They help Power Automate find the right place in SharePoint to do tasks like moving files or updating information. So, knowing these details ensures your automated workflows run smoothly without any hiccups.

In our flow, we start by extracting the SharePoint URL and SharePoint Document Library Name from the ItemURL provided by our Trigger.

Here are the expressions:

Document Library URL:

join(take(split(triggerBody()?[‘entity’]?[‘itemUrl’],’/’), 5),’/’)

Document Library Name:

replace(split(triggerBody()?[‘entity’]?[‘itemUrl’],’/’)[5],’%20′,’ ‘)


What I’ve noticed is that every SharePoint Item URL contains both the library name and the SharePoint Site. However, these URLs typically come in two types, depending on the file type they represent:

  1. URLs without “_layouts” are typically for file types like PDFs, images, and so on.
  2. URLs with “_layouts” are usually for file types such as Word documents, Excel spreadsheets, Visio diagrams, PowerPoint presentations, OneNote files, and more.

For further clarification, please refer to the accompanying images.


The issue with using the Document Library name is that if it changes, the name in the ItemURL remains the same as when the Document Library was created. This can lead to flow failures.


Even if the Document Library name changes, there’s a unique ID linked to it, which we can use in SharePoint actions instead of relying on the Library’s name.

To obtain the Document Library’s ID, we require the FileID, which is distinct from the one triggered by the flow. For URLs lacking “_layouts,” we retrieve file metadata using the path, extracting the FileID from it.

Expression: Get file guid from metadata :

replace(replace(replace(split(outputs(‘Get_file_metadata_using_path’)?[‘body/ETag’],’,’)[0],'”‘,”),'{‘,”),’}’,”)


For URLs containing “_layouts,” the FileID is readily available within the URL; all we need to do is decode the URL and extract the FileID.

Expressions:

Decode library URL:

decodeUriComponent(triggerBody()?[‘entity’]?[‘itemUrl’])

Process decoded library URL:

slice(outputs(‘Decode_library_url’), add(indexOf(outputs(‘Decode_library_url’), ‘?’), 1), indexOf(outputs(‘Decode_library_url’), ‘&’))

Get FileID:

slice(outputs(‘Process_decoded_library_url’), add(indexOf(outputs(‘Process_decoded_library_url’), ‘{‘), 1), indexOf(outputs(‘Process_decoded_library_url’), ‘}’))

As we now have the FileID we can get the Document Library ID by using the API

_api/web/GetFileById(‘@{variables(‘File ID’)}’)/?$expand=ListItemAllFields/ParentList

The Document Library ID is stored in the Process document library Id stage

Expressions
Process document library Id

outputs(‘Get_document_library_updated_name’)?[‘body’]?[‘ListItemAllFields’]?[‘ParentList’]?[‘Id’]

Now that we have the document library ID and the Site URL we can use it in various SharePoint Power Automate Actions, for example i am using it to set the content approval status to submitted.

Hope this was a helpful read 😊!  Please leave your comments and suggestions in the comments below. 

Getting SharePoint List (ID) using the SharePoint File’s (ID) in Power Automate 

I was working on a requirement where I was getting a SharePoint file’s unique ID dynamically and I wanted to know which document library or list it belonged to, after a few google searches I found out a SharePoint API using which we can easily get the Primary List or Document Library’s ID of any SharePoint File, let me show you how to do that. 

Step 1: Using the above API send and HTTP request to SharePoint via the “Send an HTTP request to SharePoint” Power Automate Action. 

Step 2: Using the below expression you can get the unique ID of the Parent Document Library or List of the file. 

You can also get the name of the parent document library or list  if you replace [‘Id’] with [‘Title’] 

(Note: Make sure to replace the name of the output action “Get_document_library_updated_name” with your output actions name ) 

This method is particularly useful when working with files dynamically across multiple libraries. 

Creating Pre-Defined Email Templates In Dynamics 365 Customer Service 


In customer service, we often encounter repetitive emails, such as acknowledgment emails for registered cases or service requests. To simplify this process, we can create standard email templates for such occasions.

Consider a scenario where you’re a product company handling warranty claims. After processing a claim, you need to notify the customer about the exchange of their product. While the core message remains the same, certain details like the customer’s name, sender’s name, tracking number, etc., vary for each email.

Rather than composing these emails from scratch every time, your service team can save time and improve efficiency by using pre-defined email templates. These templates allow for quick customization of dynamic values, ensuring consistent and prompt communication with customers.


In this blog, I’ll guide you through creating email templates and using them for your cases.

How to Create an Email Template:

Step 1: Navigate to the Customer Service Hub model-driven app in your Dynamics 365 CRM.

Step 2: Go to “Email templates” and click on “New email template”. Name your email template and specify its permission level—whether it’s for personal use only or can be used organization-wide.

 Step 3: Choose the template category, indicating the CRM entity on which you want to use this template. The template will only be available on records of that entity. Then, click “Create” to finalize and create the template.

Once you’ve created your email template, it’s ready for customization. Edit the template content according to your needs, and once you’re satisfied, simply save the template.


To insert dynamic values into your email template, locate the ribbon button labeled “</>Insert dynamic text.” Clicking on it will display a screen where you can select the desired dynamic values.

Depending on the category of the template and associated record types, you’ll see available options. For instance, if you’re working with the Case entity, you may have access to data from related entities such as Account, Contact, and User records.

For this example, let’s use the Contact’s first and last name, as well as the User’s name. These dynamic values will personalize the email content based on the recipient and sender information.

How to use this email template 

  1. Navigate to the entity for which you’ve created the template, in this case, it will be the Case entity. 
  2. Locate the timeline section on the Case entity form. If there’s no timeline, navigate to the Related section and find “Emails.” Click on it to proceed. 
  3. Once you’re in the email section, click on the “New” button to compose a new email. 
  1. In the email form, click on the “Insert Template” button, usually represented by an icon resembling a piece of paper or a template. 
  2. This will prompt you to select a field name. Choose “Regarding,” as this represents the record to which the email is related—in this case, the Case record. 
  3. Since the email template was created with the category “Case,” it will only be visible when you select “Regarding” as the field name. This ensures that the template pulls data from the Case record, such as the owner of the case or the contact associated with the case. 

Now hit select –> you will see a new pop-up and you will be able to find your template there.  

Hit save and you will have all the email content with dynamic values populated in the email body.  

Imagine simplifying all these steps into just one click. With a single button, emails are automatically generated from templates and sent to customers. Exciting, isn’t it?

Yes that is possible link to that blog is here check it out: Generated And Send Emails From Email Templates With a Button Click in Dynamics 365 Customer Engagement  

Hope this was a helpful read 😊!  Please leave your comments and suggestions in the comments below. 

Generated And Send Emails From Email Templates With a Button Click in Dynamics 365 Customer Engagement 

In the previous blog, I demonstrated how to create email templates in Dynamics Customer Service. This blog continues from there, showing you how to simplify the process of sending emails generated from these templates with just a button click.

If you’re new to this topic, I recommend referring to the first part of the blog for a better understanding. Creating Pre-Defined Email Templates In Dynamics 365 Customer Service  

Here, we’ll use JavaScript (JS) to call a Power Automate Flow. The JS function triggers upon a button click, passing the GUID of the case record clicked. 

(Note: Power Automate Flow can be triggered in various ways, not limited to button clicks. For instance, it can be initiated by changes in toggles.) 

Use case demo: 

As discussed previously, our email template contains fixed content and dynamic values like customer names and service team members’ names. 

In the previous method, users had to manually create emails, insert the template, and send them. 

In this blog, we’ll bypass these manual steps. Emails will be generated and sent with a single click. Users simply click the “send email” button on the case form. They’ll then see a progress indicator, and upon sending, receive a notification. 

Ribbon Button & JS 

Step 1: Add a ribbon button to the case form and insert the following JavaScript (JS) code into the ribbon button. Ensure to customize the notification messages and include your Flow’s HTTP request URL in the JS. 

var TriggerFlow = 
{
    Main: (executionContext) => 
    {
        debugger;
        var formContext = executionContext;
        //Strict Defined Parameters
        var RecordID = formContext.data.entity.getId().replace("{", "").replace("}", "");
        var EntityName = formContext.data.entity.getEntityName();
        formContext.data.save();
        //Find Plural Logical Name of the Entity and Call Flow
        Xrm.Utility.getEntityMetadata(EntityName, "").then(
            function (result) 
            {
                Xrm.Utility.showProgressIndicator("Please wait a moment...Shipping email record is being created")
                TriggerFlow.CallFlow({logicalEntityName: result.EntitySetName, CurrentRecord: RecordID});
            }, 
            function (error) 
            {
                console.log(error);
            }
        );
    },

    CallFlow: ({logicalEntityName, CurrentRecord}) =>
    {
        var flowUrl = "**********HTTP Request Link of your FLow***************";
        var inputdata = JSON.stringify({
                "RecordID": CurrentRecord
        });

        var req = new XMLHttpRequest();
        req.open("POST", flowUrl, true);
        req.setRequestHeader('Content-Type', 'application/json');
        req.send(inputdata);
        req.onreadystatechange = function () {

            if (this.readyState === 4) {
        
                req.onreadystatechange = null;
        
                if (this.status === 200) {                    

                    Xrm.Utility.closeProgressIndicator()
                    Xrm.Page.ui.setFormNotification("Email has been sent to the customer", "WARNING");                                       
        
                }
        
                else if (this.status === 400) {                    
                    
                    var result = this.response;
                    var alertStrings = { confirmButtonLabel: "Yes", text: "Error "+result, title: "Document was not generated" };
                    var alertOptions = { height: 120, width: 260 };

                    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
                        function success(result) {
                            console.log("Alert dialog closed");
                        },
                        function (error) {
                            console.log(error.message);
                        }
                    );
                    Xrm.Utility.closeProgressIndicator()
        
                }
        
            }
        
        };  
    }
}

Step 2: Open the desired email template to be automated and copy its GUID. We’ll utilize this later in the process. 

Power Automate Flow Implementation. 

Step 1: Create a Power Automate flow with the trigger “When a HTTP request is received.” Include the following schema in your trigger configuration 

Step 2: Within the Power Automate flow, add a “Get a row” action for both the Case entity and the User entity. This action retrieves information about the specific case and user involved in the email generation process. For the User entity, ensure to input the GUID of the support user who will be set as the From-Party of the email. This GUID can be hardcoded in the action. 

Step 3: Add another “Get a row” action, this time for the Email Template entity. Use the GUID of the email template copied earlier to retrieve its details. 

Step 4: Next, incorporate an “Unbound action” titled “InstantiateTemplate.” Pass the necessary parameters as depicted in the image below. 

Step 5: Parse the Body from the unbound action with the below Schema. 

{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "@@odata.type": {
                        "type": "string"
                    },
                    "subject": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "required": [
                    "@@odata.type",
                    "subject",
                    "description"
                ]
            }
        }
    }
}

Step 6: Create an email record, the unbound action which we parsed will give us the Subject & Description (Email Body) that was generated from the template. 

 
Step 7: The final step is to perform a bound action on email message which we created and send success (200) response back to the JS. 

Response messages back to JS, you can setup your own error handing in this flow, if anything fails you can set a (400) response to the JS. 

Hope this was a helpful read 😊!  Please leave your comments and suggestions in the comments below. 

Enable Copilot in Email’s Rich Text Editor For D365 Model Driven Apps 

With many other Copilots, available for various different model driven apps like Sales Hub, Customer Service Hub etc.  

Now there is also a Copilot available for rich text editors in Dynamics 365 model driven application. 

Before I show you how to enable this feature into your email’s rich text editor description box let’s see how the Rich text editor looks with and without the Copilot.  

Email description box without Copilot. 

  Email description box without Copilot. 

Now let’s see how do we enable this feature. 

Step 1: Go to https://make.powerapps.com/ and create a solution. 

Step 2: (Optional only if you want to enable it for a specific app) Add the Model Driven App in the solution, inside which you wish to enable this feature (In case of this example I am using “Customer Service Hub”). 

Step 3: Now Add existing as shown in the picture below –> More –> Settings. 

Step 4: In the Add existing Setting Definition –> Search “Enable Copilot in Rich Text Editor” select it and hit Next and then add this setting into your solution. 

Step 5: Select the added setting and click edit, an setting panel will open on the right hand side –> to enable the enhanced editor select Yes in the Setting environment value and vice versa this will enable or disable the setting for your entire dynamics 365 tenant. 

To enable or disable the setting for a specific model driven app add the app in this same solution. 

Now if you edit the “Enable Copilot in Rich Text” setting you will see and extra option in the settings panel –> Settings apps value (In this you will see the name of the model driven app in the solution and an option to disable or enable the Template Editor) 

Output:  

Draft email without using copilot. 

Selecting the email body and refactoring using Copilot. 

Results given by Copilot 

Note : You can also enable this feature by going into your model driven app settings, under upcoming features. (This option didn’t work for me in a few tenants). 

Hope this helps 😊! 

Outlook Actionable Messages Not Working (Blank)

Please Note: This is a continuation of the linked blog so make sure to check the previous blog before you start this one

(Link – https://powerplatformpuzzles.wordpress.com/2023/08/27/interactive-outlook-emails-how-to-leverage-adaptive-cards-input-text-box-outlook-actionable-message/ ).

In the last blog we saw how to use actionable messages with adaptive cards to send an interactive email text box,

Now these actionable messages will work perfectly in your own mail box but in-order to make these actionable messages work in other outlook mail boxes within your organization or even to external users you need to authenticate your self as a valid actionable message provider. You need to validate the originators (Sender of the actionable) email with Microsoft.

If this is not done and the originators ID (Provider Id) is not added to your actionable message the message will show up as blank in the outlook client.

So in this blog lets see how get a Provider Id and how you can make an actionable message work in other outlook mail boxes.

Step 1 : Once you have configured your adaptive card with the actionable message go to the –> Actionable Email Developer Dashboard using the link [https://outlook.office.com/connectors/oam/publish].

Step 2 : Click on New Provider

Add a name, copy the ID from the Provider Id follow the instructions given in the image below.

Scope of the submission

In this blog I will be only covering the first two options from the scope.

I would recommend not using Global Scope as Actionable message only work with outlook and certain versions of it, also email policies of users outside your organizations might also block these actionable messages and they will get a blank email, there is no certain way to determine if users outside your organizations are getting the messages correctly so hence I would recommend using this only within the organization.


Test Users

This is auto -approved and you get the approval configured within 30 mins to 1 hour so you can use this scope if you want to send an actionable message to a single user only other than your self.

To configure select test user and follow the screenshot below.

Organization

This will enable the actionable message for the entire organization, once you send this all the Global admins will get approval emails to approve your request, any one of them can approve the request, it takes 15-24 hours to get configured after approval.

Emails received by Global admins

Once your requests are approved copy the provider Id (Originator) and paste it in your adaptive card payload.

This will resolve the issue and the adaptive card will start appearing in the outlook clients.

Hope this helps 😊!

Interactive Outlook Emails: How to Leverage Adaptive Card’s Input Text Box (Outlook Actionable Message) 

Ever got emails where you can actually do stuff without opening a different app? That’s Outlook’s actionable messages for you.  

They let you take actions right from your email. You can say ‘yes’ to things, give quick answers, and change info—all from the email itself.  

No need to jump between different apps. You can use these messages for lots of things, like saying ‘OK’ to tasks, answering questions, and more. They even look nice with pictures and buttons.  

In this blog I will show you how you can combine Actionable Messages with Adaptive Cards to send an outlook message with a free text input box. 

This is an adaptive card which is sent to a user after a meeting let’s see this can be done. 

Explanation of the implementation: We will be making an outlook actionable message adaptive card and using two power automate flows, One will be a sender flow to send this adaptive card to the desired users via email and other flow will be an HTTP request flow will will be a receiver flow which will receive and process the message submitted by the users via this adaptive cards.

Lets first begin with Making an Adaptive Card.

We would require two adaptive cards  

  1. The first one will be the adaptive card which has the Text Box – This will be used in our sender flow
    1. Shown in the image above 
  2. Second one will be the response adaptive card which will be sent after the user hits submit. – This will be used in our receiver flow

Let’s begin creating the first one 

Step 1: Go to adaptive card designer –>  https://adaptivecards.io/designer/  –> click on New Card and select a blank Card. 

Step 2: Select the host app as Outlook Actionable Message and the target version should be 1.0 (This adaptive card only works best with target version 1.0)

Now our adaptive card setup is ready lets add components to this adaptive card.

Adding the below components to the adaptive card

TextBlock : Add a text block and put the title you want to display as shown in the image below.

Input.Text : Add a input text control which will be a multi line of text box in which the users will submit their inputs, adding an ID to this input element is important as we will be using this ID to pass the value in this text box to our receiver flow

Action.Http (Submit Button): Since this is an actionable message we need to add add a Http action which will send the entered data to a request URL once the user hits the submit button. ( You will get the Add an action option once you have selected the whole card & when the host app is outlook actionable messages )

Add the title to the button, select the method name as POST, add the HTTP request URL which you will get from the receiver flow shown later in this blog, and add the message body as show in the image below

{
“responseByUser”:”{{meetingnotes.value}}” (meetingnotes.value –> meetingnotes is the ID of the Input.Text element)
}

Add a header Authorization and keep the value empty, Add a Content-Type header and keep the value application/json

Now that the elements of the adaptive cards are set copy the card payload and keep it ready to be used in the sender flow.

(Below is the payload I used you can also copy this payload and put it in your editor do change the originator and your request url)

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "originator": "[HOW TO GET THIS IS EXPLAINED IN THE LINKED BLOG BELOW]",
    "version": "1.0",
    "body": [
        {
            "type": "TextBlock",
            "text": "Please add your meeting feedback below ",
            "wrap": true
        },
        {
            "type": "Input.Text",
            "placeholder": "please enter your meeting notes in this box",
            "isMultiline": true,
            "maxLength": 1000,
            "id": "meetingnotes"
        }
    ],
    "actions": [
        {
            "type": "Action.Http",
            "title": "Submit",
            "id": "Submit",
            "method": "POST",
            "url": "[URL OF YOUR SENDER FLOW OR RECIEVING URL]",
            "body": "{\n\"responseByUser\":\"{{meetingnotes.value}}\"\n}",
            "headers": [
                {
                    "name": "Authorization",
                    "value": ""
                },
                {
                    "name": "Content-Type",
                    "value": "application/json"
                }
            ]
        }
    ]
}

Sender Flow

  1. For this example I am using a Manually triggered flow, paste the payload of the adaptive in a compose.
  2. Add the output of this compose to the body of send an email (V2) action, you need to add this in the code view of the email action and using the script below.
<p><script type="application/adaptivecard+json">@{outputs('Adaptive_card_code')}</script></p>

The sender flow is ready to send the actionable messages to users.

Receiver Flow

  1. The trigger of the receiver flow is When a HTTP request is received.
  2. The HTTP POST URL should be added in the URL section of the Action.Http (Submit Button)

Add the below JSON Schema to the HTTP request trigger.

{
"responseByUser":"text"
}

Make sure the objects of the payload are same in the Action.Http (Submit Button) request body and the HTTP request schema, in simpler words you are passing an object by the name “responseByUser” through the adaptive card request so your flow flow schema should also have an object by the same name “responseByUser

In the response adaptive card payload use the below adaptive card payload. (You can directly use the below payload) or create a simple response adaptive card of your own.

{
  "type": "AdaptiveCard",
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.3",
  "body": [
    {
      "type": "TextBlock",
      "text": "Your response has being registered !",
      "wrap": true,
      "id": "titlebox"
    },
    {
      "type": "TextBlock",
      "text": "Thank you, your notes will be updates on the case and appointment automatically.",
      "wrap": true,
      "id": "messagebox"
    }
  ]
}

The response should have a status code 200 and the header should be CARD-UPDATE-IN-BODY set to true.

Lastly the body of the response should be the response adaptive card

This actionable message will work great within your own mail box, but when you sent it to other users it might just send blank emails, to avoid this from happening you need to authenticate the senders emails, it is recommended to do this step for smooth operations. Follow the next blog to for the final steps.

Link – https://powerplatformpuzzles.wordpress.com/2023/08/27/outlook-actionable-messages-not-working-blank/

Enable / Disable Advance Email Template Editor – Dynamics 365 CRM

The enhanced email template editor provides advanced features for creating personalized and dynamic email templates, whereas the regular email editor offers a simpler interface for sending individual emails quickly without extensive customization options.  

The choice between the two depends on the specific needs and preferences of CRM users and the nature of the communications they’re handling. 

So some users might like to use the advance email templates where as some might want to stick to the older rich text editor. 

In this blog I will show you how you can enable the advance email template editor, and if it is enabled by default through updates, then how to disable it. 

First let’s see how the old email template editor looks, as compared to the new one. 

Old Email Template Editor. 

New Email Template  

In the new email template editor you can drag and drop text image and many other components you can add HTML and CSS styles to the content. 

Let’s see how you enable or disable this feature for all your environments or for a single model driven app. 

Step 1: Go to https://make.powerapps.com/ and create a solution. 

Step 2:  Inside your solution click on Add existing –> More –> Settings. 

Step 3: In the Add existing Setting Definition –> Search “Enable the New Template Editor” select it and hit Next and then add this setting into your solution. 

Step 4: Select the added setting and click edit, an setting panel will open on the right hand side –> to enable the enhanced editor select Yes in the Setting environment value and vice versa this will enable or disable the setting for your entire dynamics 365 tenant. 

To enable or disable the setting for a specific model driven app add the app in this same solution. 

Now if you edit the “Enable the New Template Editor” setting you will see and extra option in the settings panel –> Settings apps value (In this you will see the name of the model driven app in the solution and an option to disable or enable the Template Editor) 

Hope this helps 😊! 

Create word document using Power Automate Flow 

You can create a word document and insert dynamics values in the word document, using the Populate word template action in a Power Automate Flow,  

In this blog I will show you how you can simply create a word template and use this word template to create a word document in Power Automate. 

So Let’s Begin.. 

Create Word Template & Store it in SharePoint. 

Step 1: In a word document right click on the ribbon and select on Customize the Ribbon. 

Step 2: In the Customize Ribbon enable Developer option by ticking the check box. 

Step 3: Now you have access to the developer section of the word, in ribbon in the controls section you will get a list of controls which you can use like the check box, rich text, plain text, repeating control, image control.  

What are controls in a word document ? 

In Microsoft Word, “controls” refer to various interactive elements or form fields that you can insert into your document. These controls are useful for creating interactive and dynamic documents, such as forms, surveys, and templates.  

You can basically use a control to take dynamics inputs within a word document. 

Step 4: Insert a plain text control as shown in the image below and click on design mode. 

Step 5: For the plain text control we added in step 4 click on properties and add Title and Tag to the control, (Adding Title & Tag is important as this tag and title will be used to input values in the Power Automate Flow action) 

Now the Sample Word Template is as shown in the image below, I have added plain text controls and a title and tag to each of the control. 

Step 6: Final step is to save this word template which we created into your SharePoint, I have stored it in a document folder within my default communication site.  

Power Automate Flow. 

For this example I will be using a manually triggering flow  and I will be providing inputs to this flow. 

Step 1: Once your flow inputs are set, in the flow step search for Populate a Microsoft Word Template action. 

Step 2: Now within the action select the SharePoint location where we have stored the word template which we created in the earlier steps,  

Once you have selected the word template file, you will see all the Title & Tags we had applied to the content control inputs properties. 

Step 3: From the Populate a Microsoft Word Template step you will get the file content of the generate word document, you can either create a word file within your SharePoint or email a word file .. etc, many different ways to store this file. 
 
Make sure you name the file with the file extension .docx else the generated file won’t open. 

Outputs:  

Flow Inputs 

Generate Word File with the dynamics inputs populated in the content control through the flow. 

Hope this helps 😊! 

Dynamically populating tables in word document using Power Automate 

One challenge while creating word documents using power automate is adding values to tables in the word document template. 

In this blog I will show you how you can populate values in table in a word document template dynamically using power automate flow. 

Example – I have a Power Automate flow which triggers on click of a button on my quote and it generates a Quote using a word template from my SharePoint, now in this quote template I want to populate all my Quote Line Details one after another into a table, so let’s see how we can do this 

Word Document Setup 

Step 1 Create table in your word document template, and add a plain text content control in each of your column of the table. 

If developer tab is not visible in your word document please follow the link and enable developer tab – Enable Developer Tab 

Step 2: Assign a label name and a title and tag name to each of added plain text content control input, these label names should be single character and we will be using them in the power automate flow further in the blog. 

Column Name         Label names (Column name & Label names in the below image) 

Sr No                          Srno 

Task                           description 

Estimates(Hours)    quantity 

Step 3: Select all the columns which you dynamically want to populate and add a repeating control on the selected columns. 

The word document table is ready to be used in our Power Automate flow. 

Power Automate Flow 

Step 1: In you Power Automate flow initialize two variable. 

Variable 1 – Array variable named Table 

This variable will hold an array of all the values of which will be populated in tables rows. 

Variable 2 – Integer variable named Sr no 

This variable will store Serial number values for each of the tables rows. Keep the initial value of this variable to number – 1 as our serial number will start from number -1. 

Step 2: Create a Json of the Label values which we assigned in the table and the values you want to dynamically populate within that column of the table. 

{ 

  "description": "{The data you want to populate in the column (plain text control) labelled by the name description }", 

  "quantity": "{The data you want to populate in the column labelled by the name quantity}", 

  "Srno": "Add the serial number variable here" 

}

Step 3: Next step is to loop the data which you want to populate in the table append the Json which is getting created for each iteration of the loop into the Table array variable which we defined in step 1 and increment the Sr No variable by 1.  

Step 4: Final step is to update the table array into the word document. 

In the word document the labels of the plain text control within the table columns will be visible to you, on the top right of the table input click on “Switch to input entire array” button and add the table array. 

This is how you dynamically populate multiple values with in a table in your word document template. 

Flow output. 

Hope this was helpful please feel free to submit any feedback in the comments below 😊!