Showing results for 
Search instead for 
Did you mean: 

Using the Azure Logic Apps Workflow Definition Language (WDL) in Microsoft Flow



Author : Serge Luca

Office Servers and Services MVP, Belgium




There are many situations with Microsoft Flow where we need non standard features, and as developer  I am way too often tempted to jump on the custom api and to create my custom Azure function or Azure Web API to provide exactly what I need. If all you have is a hammer everything will look like a nail…


Using the hammer can be overkilled so let’s add another tool to our (Flow) toolbox.


In some cases using the Azure Logic Apps Workflow Definition Language (WDL) directly  can be convenient. This WDL is actually part of Logic Apps, the workflow engine running behind Microsoft Flow.


This WDL is used behind any Flow and it shows-up in the Flow Designer.


Let’s take 4 examples.


Example 1  (the easy one)


I have a SharePoint list with a custom column named "Amount". The flow is triggered when a new item is added into the list and I want to check its value. This is straightforward in Flow :




If we click the “option “Edit in advanced mode” we will see the Logic Apps WDL expression.




To find more information regarding the Logic Apps WDL, go to the following site :




A flow is actually composed of a set of JSON objects and the associated value pairs are available from the WDL.


Example 2


A Flow is triggered when a new item is added in a SharePoint list. The SharePoint list has a “ID” system column which is unique. Each row is a contract and the contract ID must be unique. The contractID is automatically generated when the item is added in the list.

The logic is : CONTRACT-XXXX where XXXX is the list idem ID minus 10 and formatted on 4 letters.


ex if ID is 50, the contract ID must be CONTRACT-0040.


To generate the contract, we need to rely on the Compose action.

The workflow will look like this :




The second action is the Compose action with the following value :




The WFDL code will look like this :






If the SharePoint ID is 51

  • ?[‘ID’])  will return 51  (as a string) ; triggerBody returns the JSON object containing the trigger action.
  • float(triggerbody()?[‘ID’]) will return 51 (as a float)
  • sub(float(triggerbody()?[‘ID’]),10)  will remove 10 from 51-> 41
  • add(sub(float(triggerbody()?[‘ID’]),10),10000)  will add 10000 ->10041
  • substring(string(add(sub(float(triggerbody()?[‘ID’]),10),10000)),1,4) ->0041


In order to dig a little bit I’ve checked the content of triggerbody() by adding a Compose action (by the way don’t forget the double quotes before and after the expression)




What we get is this (a nice JSON result) :




I also noticed after running the flow, that my custom code became a Body variable (the body variable was not available before) :




For the record  trigger-body() is a shorcut for trigger().outputs.body



Example 3.  


Let’s take a look at the Flow template




The logic of this template is that if the last blog post has been posted more than days days ago you will get a reminder. Here the condition must be expressed in WDL : (the basic mode doesn’t work at all)




The WDL code is the following:


@less(string(first(body(‘List_all_RSS_feed_items’))[‘publishDate’]), addDays(utcnow(),-10))


body(‘List_all_RSS_feed_items’) : returns the raw content of what the action List all RSS feed items returns.


If we open a blog feed in a browser, for instance my own blog feed

we will see that the publication date is a field named




However when we run the worklfow and check the value associated with a completed instance, we see this :




Even tough the RSS is xml based, the RSS action has transformed it into JSON and the “Pubdate”  field has been renamed “PublishDate”




So string(first(body(‘List_all_RSS_feed_items’))[‘publishDate’])  returns the publishing date of the first post (which is chronologically the last one)


@less(string(first(body(‘List_all_RSS_feed_items’))[‘publishDate’]), addDays(utcnow(),-10)) says if the last blog post has been published before today minus 10 days then a reminder needs to be sent.


So the rule is:

  • if you want to analyse an action output, use body()
  • if you want to analyse an trigger output, use trigger_body()  

Don’t forget to add the WDL site to you favorites.



Example 4. You want to check if a query to a SharePoint list is empty


The key thing is that  the list of all the items returned from Get item is stored in a vriable called ‘value’.


-> if you switch the Condition action in “advacned” mode, you can type the expression:  “@empty(body(‘Get items’)[‘value’])




Another (less efficient) option would be:  @equals(length(body(‘Get Items’)?[‘value’]),0)


Have fun !


Author : Serge Luca

Office Servers and Services MVP, Belgium




Hi Serge,


I guess not, but would it be possible to strip out all html tags from a given string of text?



Thanks for the great post.


Are you aware of an elegant way to look for a value in a JSON array?


This is the data that "ActionOutputs('HTTPAction')?['Body']" returns:



  "RequestedType": "PeopleList"



      "Name": "Mike",










If I use "ActionOutputs('HTTPAction')?['Body']?['People'][1]['Surname']" it will return Joe Doe's surname, but what if I don't know which number of the array holds the value that I am looking for? If there a way to look for Joe's name and then return his Surname using WDL, or do I have to use Flow to parse and then for each to loop through the data?

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, 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 (
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor