Intro

What is the definition of Compose action with Microsoft Flow?

Use the Data Operations – Compose action to save yourself from entering identical data multiple times when you’re designing a flow. What does this mean in practice? You can shape the data that has been generated by an above action, by using an expression or adding data that you want to use several times in your flow.

In this example I will explain the expression Date and Time, with an example of some of the date and time expressions.

Work Less, Do More”

The flow what is it doing?

The flow that I will use to demonstrate some of the date and time expressions, has the following actions and connectors:

  • Outlook – When a new email arrives
  • Data Operations – Compose
  • SharePoint – Create file

The flow will be triggered by an email that has been send to an inbox from a certain sender and with an attachment and subject “SharePoint”. When the flow has been triggered, we will create a date and time format that will be attached to the file name on creation in the SharePoint document library.

Flow overview:

flow02-02
High level view of the flow

flow02-01

 

I will explain here a view of them:

Expression: formatDateTime(timestamp,format)

Returns a string in date format

Expression string:

String formatDateTime(triggerBody()?[‘DateTimeReceived’],’yyyyMMdd’)
Result 20180930_Flow_Test_File.txt

This expression will get “Date Time Received” from the email and format will be change to yyyyMMdd and attached to the new file name that will be create in SharePoint.

With:

yyyy = year (example: 2018)
MM = month (example: 08)
dd = day (example: 11)

Expression: utcNow()

Returns the current Coordinated Universal Time timestamp as a string

Expression string:

String utcNow() utcNow(‘yyyy’)
Result 2018-09-30T20_15_18.0324638Z_Flow_Test_File.txt 2018_Flow_Test_File.txt
String utcNow(‘dd’) utcNow(‘MM’)
Result 30_Flow_Test_File.txt 09_Flow_Test_File.txt
String utcNow(T’) utcNow(‘t’)
Result 8_35_16 PM_Flow_Test_File.txt 8_36 PM_Flow_Test_File.txt

Combination is also possible with the formatDateTime – expression an example:

String formatDateTime(utcNow(),’yyyy-MM-dd’)
Result 20181001_Flow_Test_File.txt

Expression: GetFutureTime(interval,TimeUnit,Format?)

Returns a timestamp that is the current time plus the specified time interval.

Interval need to be an integer and the time unit: “Second”, “Minute”, “Hour”, “Day”, “Week”, “Month”, “Year”

Expression string:

String getFutureTime(5,’Hour’,’yyyy-MM-ddThh:mm:ss’)
Result 2018-10-01T02:52:25_Flow_Test_File.txt

More information about Date and Time formatting can be found it’s LINK

I hope you have found the usefully to add some date and time formats to your Microsoft Flow.

flow02-04REMARK

String need to be entered by using the expression selection. I had already the experience when typing the text manually it’s not accepting the content. So select the expression and add them automatically in the Compose field to edit as appropriate.

 

flow02-03

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: