MS Flow tips

Admin page: https://admin.flow.microsoft.com

 

Compare date with today in SQL Query:

select [UserId],[FullName],[MissingDays] from raw.tidsoptimists where CONVERT(varchar, RecordedDate, 23) = CONVERT(varchar, getdate(), 23)

Convert to JSON: Remember to use “Use sample payload to generate schema” to get Schema

Get current date (use expression):

utcNow(‘yyyy-MM-dd’)
Get JSON result as table (add a new step and use result from parse JSON step, then you will be able to see the result as table (including all rows)):
@{body(‘JSON_for_Tids_Optimists’)?[‘ResultSets’]?[‘Table1’]}
Find DateIff from today with another date in SQL Query:
SELECT DATEDIFF (day, CONVERT(date, ‘@{items(‘Apply_to_each_2’)?[‘Year’]}-@{items(‘Apply_to_each_2’)?[‘Month’]}-01′), GetDate()) AS TodayDiff
Get TodayDiff above:
1. Parse to JSON
2. Take value from JSON like this:
first(body(‘JSON_DateDiff’)?[‘ResultSets’]?[‘Table1’])?[‘TodayDiff’]
3. You can also compare it with another number, such as:
greater(first(body(‘JSON_DateDiff’)?[‘ResultSets’]?[‘Table1’])?[‘TodayDiff’], 35)
.

 

 

How to export and import a Microsoft Flow

I. Export

  1. Select a flow that you want to export
  2. Click on …More to select Export -> Package (.zip)
  3. Select option “Create as new”
  4. Unzip the package, look for the definition.json file
  5. If you want to change the trigger then replace the trigger by editing the file (The easier way is export another package with another trigger, compare and change the current file as that file). In my case, I changed the “swaggerOperationId” from “GetOnUpdatedFileItems” to “GetOnNewFileItems”, and the path also to “…/onnewfileitems”
  6. Change the “name” and the “id” to using the new GUID
  7. Change the display name

II. Import

  1. Click to “Import”
  2. Select a zip file and wait until you see the “Review Package Content”
  3. ┬áMake sure you have a new name in “Choose your import options.”
  4. Now, its time to change the related resources. If you import the zip file in the same environment, I suggest you select the existing one in the list (don’t click “Create new”)
  5. When everything ready, click “Import”
  6. Test the new flow to make sure everything works correctly.

Have fun!