cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheJoeFletch
Frequent Visitor

Microsoft Teams - Selected Message - Adaptive Card - Default Date Calculation

Sorry this is probably an easy one, but cannot seem to figure it out.

I have created a Power Automate flow using the Microsoft Teams For a selected message and I want to customize the Adaptive Card further. I would like to default my date to a dynamic value; TODAY + 7 days.

 

{
"type": "Input.Date",
"id": "DueDate"
}

 

 

I have another element that has a default hard-coded value and is setup like this, but can't figure out how to make it dynamic.

 

"value": "SomeValueGoesHere"

 

 

4 REPLIES 4
DamoBird365
Microsoft
Microsoft

Hi @TheJoeFletch 

 

According to the schema here https://adaptivecards.io/explorer/Input.Date.html

Property value sets the initial date

value string No The initial value for this field expressed in YYYY-MM-DD.

 

You could use a compose with the following expression:

formatdatetime(addDays(utcnow(),7),'yyyy-MM-dd')

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

 

I tried entering the following, but the Adaptive Card will not save (probably because there is a syntax issue).

 

"value": formatDateTime(addDays(utcnow(),7),'yyyy-MM-dd')

 

 

 I also tried using $now() but that does not work either.

 

In researching further, I don't think that it is possible to set a dynamic date because this Adaptive Card is JSON based and is thus static.

DamoBird365
Microsoft
Microsoft

Hi @TheJoeFletch 

 

Nearly there... you need to type that into the expression builder:

 

DamoBird365_0-1614342041275.png

 

TheJoeFletch
Frequent Visitor

I'm aware of the expression builder, but I cannot seem to have that menu show up. How are you getting to this menu?

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,009)