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
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • I am building business processes and applications that are easy for users' to stick to, so they can follow and understand them. In overall I transform processes to be more reliable and effortless. I am a proud co-organizer of SharePoint Saturday Warsaw and active community member, blogger and international speaker.