cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Use dynamic Content in Expressions?

Hello,


i want use dynamic Content in Expressions.


I have the Received Time from e-mail and i want to use the Exppression "formatDateTime". But i dont know, how i can declare the dynamic content "Received Time" in the expression like formatDateTime([Received Time], MM-YYYY).

 

I want to export emails into onedrive for business an the name of the emails should look like this: "Subject-YYYY-MM". So when i use the dynamic content "Received Time", i get a timestamp like this 2017-12-20T10:00:00:0000Z. So i want to format the timestamp 🙂


Thanks for help!

12 REPLIES 12
v-yamao-msft
Community Support
Community Support

Hi MS_ycmh1992,

 

Please try to add the following code in a Compose action, then you would get the date time formatted as “yyyy-MM”.

formatDateTime(triggerBody()?['DateTimeReceived'],'yyyy-MM')

3.PNG

Please have a try with it and feel free post back if you need more help.

 

More details about formatDateTime function, please see it at here:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Yes , it worked for me. 

 

any idea on how to get the triggerBody() all attributes . 

 

Regards,

Bangar Raju

Aren't they visible in "Dynamic Content"?

 

What you can do is:

  • Go to "Expression"
  • Start entering your function
  • Click on "Dynamic Content"
  • Scroll and click on the attribute you need: it will add the value automatically in the expression

Is there any way to copy the 'triggerBody()?['Provider']' when it pop up by putting mouse on it

kdavis91
Continued Contributor
Continued Contributor

@MW3 

 

I don't believe so.

Unfortunately, this is broken. The Dynamic Content doesn't always display the item you need, so you have to use the search box.  But when you start creating an expression and switch back to the dynamic content window, the search box is replaced by the expression box and you can no longer search for items. This is a VERY broken User Experience issue.  The discoverability of variables, items, and expression usage is completely broken in PA.

I agree! I was having the same challenge but I think I just figured out how to get it to work.

I clicked on the Expression tab. In the fx window, I typed the name of the function (clicking the function in the list works also).

I put my cursor between the parentheses/brackets ( ), then clicked the Dynamic content tab. This allowed the fx window to remain visible.

(No, I can't search for the Dynamic content from here, but they are listed alphabetically. So if I don't know the name of the Dynamic content, I would search it first before clicking the Expression tab.)

Then I scrolled to the DC that I needed and clicked it. It inserted the "triggeroutputs..." between the parentheses/brackets ( ). I clicked OK and the complete expression was inserted where I needed it! 😊

The purple fx in the first row is the finished appearance.

SharonFryLV_0-1628280225655.png

 

On the subject of formatting date and time, this can take care of it also:

Converting time zone in Microsoft Power Automate

https://support.microsoft.com/en-us/topic/converting-time-zone-in-microsoft-power-automate-8bce2441-... 


@SharonFryLV wrote:

I agree! I was having the same challenge but I think I just figured out how to get it to work.

I clicked on the Expression tab. In the fx window, I typed the name of the function (clicking the function in the list works also).

I put my cursor between the parentheses/brackets ( ), then clicked the Dynamic content tab. This allowed the fx window to remain visible.

Remember having used it, unfortunately that doesn't work (for me at least) anymore, i'm getting "no dynamic content available" error:

Pion_G_0-1635429754387.png

 

Do you have any steps prior to this one that produce dynamic content?


@SharonFryLV wrote:

Do you have any steps prior to this one that produce dynamic content?


Sure : proof is that when initially selecting the "dynamic content" tab I've several.

As soon I insert a function in the "expression" tab, put focus between the parenthesis and switch back to "dynamic content" tab, I'm getting that error.

@SharonFryLV 
I've suddenly understood that issue was different.
It was the same that is described there : 

Adding link with dynamic content in ‘send an email notification (V3)’, Power Automate – Shakir's Blo...
And the solution worked!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,964)