cancel
Showing results for 
Search instead for 
Did you mean: 

10 MS Flow hacks/ troubleshoots/ workarounds that might help you while building flows

In this article I will highlight 10 interesting flow hacks/ workarounds that might help you in building your flows. This article is inspired by a couple of questions that I have been repetitively seeing on the community forums. Being documented at one place, it could be a good cheat sheet for all levels of users (beginners/ mid/ pros) while building flows.

Let’s get started!

SharePoint Person type/ Choice type columns (Multi Select): While creating an item on SharePoint List with Flow, it is easy to provide the values for a single select Choice type/ Person type columns. But for a multi select on the above data types, an array of values is to be passed. For the multi select choice type column use: 

[
{
"Value": "Choice 1"
},
{
"Value": "Choice 2"
}
]

Here, "Value" is the attribute for choice if the column allows creating new values to the choice field, just keep adding the key as "Value" and the value as the choice that you want to add in the column. For a multi select person type column, use:

[
{
"Claims": "user2@testsite.onmicrosoft.com"
},
{
"Claims": "user1@testsite.onmicrosoft.com"
}
]

Here, "Claims" is the key and you need to provide the email addresses of the user on the organization. F1a.png 

SharePoint time zone issues: While writing data to a “DateTime” type column in SharePoint, the data will be taken as UTC (SharePoint assumes it is UTC even if you send a time zone formatted date) and converted to the time zone set on the regional settings of the SharePoint site. To address this issue, either change the SharePoint Site regional settings to UTC and send data from Flow according to your time zone or else send data from Flow in UTC and change the regional settings in SharePoint site to your region.

Excel “DateTime” data type issues: In a scenario when you try to get data from an Excel Online connector and the column is a “DateTime” data type column, it returns an integer number. To address this, either convert the data type of the excel column to plain text or implement the expression on the returned integer number as shown in the thread here.

Send images to a SharePoint column: When you create a picture type column in SharePoint, and try to create an item on the List using Flow, the picture type column does not appear (it does not allow you to add any inputs to the picture type column from here). Due to this limitation, you cannot send image type URL's to a SharePoint List. Therefore, a work around for this is, create a Multiple Lines of Text column and on the column click Modify Settings -> Format the column -> use the below JSON Schema:

{
  "elmType": "a",
  "attributes": {
      "href": "@currentField",
      "target": "_blank"
  },
  "children": [
    {
      "elmType": "img",
      "style": {
        "width": "100px"
      },
      "attributes": {
        "src": "@currentField"
      }
    }
  ]
}

Note: This does not format the binary data of the image. You will have to send the image URL only. (JSON Format Source)MicrosoftTeams-image (58).pngPowerApps trigger control: One of the most commonly seen issues with a flow that is supposed to be triggered from a PowerApps based control is:

Unable to process template language expressions in action 'XYZ' inputs at line 'A' and column 'Z': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_xyz']['connectionId']' cannot be evaluated because property 'shared_xy' doesn't exist, available properties are 'shared_xy, shared_xz'. Please see https://aka.ms/logicexpressions for usage details.'.

This error message basically indicates that there have been certain modifications made/ actions added to the Flow after it was registered on the PowerApps control. The remediation for this is to simply remove the flow from the control in PowerApps and re-register it over there.

HTTP Response to PowerApps: When you want to pass data in the form of JSON as a response to PowerApps, instead of using the "Respond to PowerApps" action and performing multiple string manipulations, you can use the "Response (HTTP)" action to send the data. The JSON schema that your data is in, needs to passed in this action so that the data is appropraitely returned to PowerApps. In case, the JSON schema is not defined correctly, boolean data will be returned.MicrosoftTeams-image (57).png

 

Split text on ‘Enter’ key: In scenarios when a user wants to extract and analyse data (from HTML, email, multi lines of fields etc.), analysing the text line by line is a generic approach. One of the easiest hacks for this is initialize a string variable and then in the value, just hit an enter. Now initialize an array type variable and use the expression editor to split the data using the string variable enter key as a delimiter. Example:

ene.PNG

Here, I am getting the body of the email and splitting it over the 'enter' key to read individual lines and process the data. 

Parse XML data/ response (SOAP message): If the data returned from an action (such as Send an HTTP Request) is in the form of a SOAP message that contains namespaces, there is no direct action to parse this the way there is for parsing JSON data. So, if action returns this type of a response, you need to compose the result as an XML formatted data and use XPATH function to retrieve the keys.MicrosoftTeams-image (49).png

Expression: first(xpath(xml(variables('Response')), '//*[local-name()="Envelope"]/*[local-name()="Body"]/*[local-name()="GetStockPriceResponse"]/*[local-name()="Price"]/text()'))

Here, to get the keys without the namespaces, the 'local-name()' is used. Source for XML Sample

Create HTML tables from multiple data sources: There might be scenarios when the data from an action is of type list and the requirement is to create an HTML table combining the data from two such actions. To do this, Create an Array and append the values with the desired column headers and map the relevant data from the dynamic selector. You will have to use two apply to each loops and iterate over each item in both the data sources to find the unique value based data and then append the array variable. Once the filtered array is ready, you can create the HTML table with the required columns by using the Create HTML table action directly.F1a1.pngNested Flows: If you have scenarios where you want to run a flow on a schedule/ recurrence but this Flow has certain 'other' dependencies, the Flow Management connector and actions can be used to handle this. You can have a parent flow that can toggle the status (on or off) for the child flow (recurrence/ scheduled/ one time run/ dependency) based on certain actions. In the child flow, you can have the last action to turn of the current flow. This will create a loop that the child flow is activated from the parent flow only and then it is turned of by itself once executed. The flows need to be present in the same environment and the relevant access is needed for the user to use this functionality. 

In this article I have shown you 10 hacks/ troubleshoots/ workarounds with the most commonly faced issues in Flow. There are many such interesting scenarios and those have been posted as solutions on the community forum here. It is highly recommended to run through these while facing any issues or before creating a new thread as a solution to an issue you are facing might already have been provided and all one has to do is look in the right place.

I hope you found this interesting and it helped you. Thank you for reading!

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of https://plumsail.com, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc ( https://triad.co.uk)
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor