cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
grazzhopper
Level: Powered On

[Beginner] trying to get functions to work in a flow with compose

Hi,

 

Call me stupid, but I don't get the following simple flow to work. Beginner here with MS-Flows. Man Embarassed

 

  1. trigger every interval
  2. get the current (UTC) datetime 
  3. add two hours to it
  4. save it in a SQL database

 

 

image.pngI do something wrong here. 

 

I read that I need to get the output of Current Time area and use the functions in the Compose between quotes, but even with things like: "@addHours(Body()?['Current_time'],'2')" or variants I seem to miss the logic behind it.

 

If someone can help a beginner out I'd greatly appreaciate it!

 

Thnx,

Grazz.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: [Beginner] trying to get functions to work in a flow with compose

Hi @grazzhopper,

 

The way you want to approach the Compose step is by building the expression on the Expression panel. For example, when you select the Compose inputs field, the Dynamic content window will pop up on your right, and once there you can select the Expression tab. From there you can either start typing the function name, which in your case is addHours, and intellisense will give you suggestions as you type, or you can scroll down to the Date and time functions section and select the addHours() from
there.
addHours-1.JPG

 

After you select the addHours function, click inside the function's parenthesis and switch back to the Dynamic content tab. From there, select the Current time from the options below, and then add the number of hours you need. Click OK and save your flow. This is what your function will look like: 

addHours(body('Current_time'),2)

 addHours-2.JPG

 

Please let me know if you have any questions.

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

3 REPLIES 3
Super User
Super User

Re: [Beginner] trying to get functions to work in a flow with compose

Hi @grazzhopper,

 

The way you want to approach the Compose step is by building the expression on the Expression panel. For example, when you select the Compose inputs field, the Dynamic content window will pop up on your right, and once there you can select the Expression tab. From there you can either start typing the function name, which in your case is addHours, and intellisense will give you suggestions as you type, or you can scroll down to the Date and time functions section and select the addHours() from
there.
addHours-1.JPG

 

After you select the addHours function, click inside the function's parenthesis and switch back to the Dynamic content tab. From there, select the Current time from the options below, and then add the number of hours you need. Click OK and save your flow. This is what your function will look like: 

addHours(body('Current_time'),2)

 addHours-2.JPG

 

Please let me know if you have any questions.

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

grazzhopper
Level: Powered On

Re: [Beginner] trying to get functions to work in a flow with compose

This was what I was missing! Thank you! Thank you! Thank you, @faustocapellanj!

Super User
Super User

Re: [Beginner] trying to get functions to work in a flow with compose

You're welcome @grazzhopper. I'm glad I was able to help.


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,494)