cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Amanstv
New Member

Weekly recurring mail with dynamic date and day

Hi All,

 

I have created a recurring flow for sending out my weekly reports which triggers on every Monday of the week for the coming Wednesday and Thursday. I want to have somewhat like this as the subject line with changing date and day automatically. Here is the subject line for reference - Weekly Report (9th and 10th June). I want the date and day formatted like this and recurring in nature whenever the flow triggers on Monday. Any help would be highly appreciated.

 

best,

AS

1 ACCEPTED SOLUTION

Accepted Solutions
annajhaveri
Super User
Super User

@Amanstv  please follow below steps to create subject link dynamically like Weekly Report (9th and 10th June) when you flow runs every Monday

 

1. Add Compose action, name it as "Get Wednesday Date" and configure below expression

int(formatDateTime(addDays(utcNow(),2),'dd'))

 

2. Add Compose action, name it as "Get Thursday Date" and configure below expression

int(formatDateTime(addDays(utcNow(), 3), 'dd'))

 

3. Add Compose action, name it as "Get Wednesday Date Ordinal" and configure below expression

if(endsWith(string(outputs('Get_Wednesday_Date')),'12'),formatNumber(outputs('Get_Wednesday_Date'), '#th'),if(endsWith(string(outputs('Get_Wednesday_Date')),'13'),formatNumber(outputs('Get_Wednesday_Date'), '#th'),if(endsWith(string(outputs('Get_Wednesday_Date')),'1'),formatNumber(outputs('Get_Wednesday_Date'), '#st'),if(endsWith(string(outputs('Get_Wednesday_Date')),'2'),formatNumber(outputs('Get_Wednesday_Date'), '#nd'),if(endsWith(string(outputs('Get_Wednesday_Date')),'3'),formatNumber(outputs('Get_Wednesday_Date'), '#rd'),formatNumber(outputs('Get_Wednesday_Date'), '#th'))))))

 

4. Add Compose action, name it as "Get Thursday Date Ordinal" and configure below expression

if(endsWith(string(outputs('Get_Thursday_Date')),'12'),formatNumber(outputs('Get_Thursday_Date'), '#th'),if(endsWith(string(outputs('Get_Thursday_Date')),'13'),formatNumber(outputs('Get_Thursday_Date'), '#th'),if(endsWith(string(outputs('Get_Thursday_Date')),'1'),formatNumber(outputs('Get_Thursday_Date'), '#st'),if(endsWith(string(outputs('Get_Thursday_Date')),'2'),formatNumber(outputs('Get_Thursday_Date'), '#nd'),if(endsWith(string(outputs('Get_Thursday_Date')),'3'),formatNumber(outputs('Get_Thursday_Date'), '#rd'),formatNumber(outputs('Get_Thursday_Date'), '#th'))))))

 

5. Add Compose action, name it as "Get Month" and configure below expression

formatDateTime(addDays(utcNow(),2),'MMMM')

 

6. Add Compose action, name it as "Combine Date for subject" and configure below expression. The output of this action is the subject line you need. so use output of this action in the email action

concat('Weekly Report (',outputs('Get_Wednesday_Date_Ordinal') ,' and ', outputs('Get_Thursday_Date_Ordinal'), ' ', outputs('Get_Month') ,')')

 

Full flow screenshot

annajhaveri_0-1623233627229.png

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
annajhaveri
Super User
Super User

@Amanstv  please follow below steps to create subject link dynamically like Weekly Report (9th and 10th June) when you flow runs every Monday

 

1. Add Compose action, name it as "Get Wednesday Date" and configure below expression

int(formatDateTime(addDays(utcNow(),2),'dd'))

 

2. Add Compose action, name it as "Get Thursday Date" and configure below expression

int(formatDateTime(addDays(utcNow(), 3), 'dd'))

 

3. Add Compose action, name it as "Get Wednesday Date Ordinal" and configure below expression

if(endsWith(string(outputs('Get_Wednesday_Date')),'12'),formatNumber(outputs('Get_Wednesday_Date'), '#th'),if(endsWith(string(outputs('Get_Wednesday_Date')),'13'),formatNumber(outputs('Get_Wednesday_Date'), '#th'),if(endsWith(string(outputs('Get_Wednesday_Date')),'1'),formatNumber(outputs('Get_Wednesday_Date'), '#st'),if(endsWith(string(outputs('Get_Wednesday_Date')),'2'),formatNumber(outputs('Get_Wednesday_Date'), '#nd'),if(endsWith(string(outputs('Get_Wednesday_Date')),'3'),formatNumber(outputs('Get_Wednesday_Date'), '#rd'),formatNumber(outputs('Get_Wednesday_Date'), '#th'))))))

 

4. Add Compose action, name it as "Get Thursday Date Ordinal" and configure below expression

if(endsWith(string(outputs('Get_Thursday_Date')),'12'),formatNumber(outputs('Get_Thursday_Date'), '#th'),if(endsWith(string(outputs('Get_Thursday_Date')),'13'),formatNumber(outputs('Get_Thursday_Date'), '#th'),if(endsWith(string(outputs('Get_Thursday_Date')),'1'),formatNumber(outputs('Get_Thursday_Date'), '#st'),if(endsWith(string(outputs('Get_Thursday_Date')),'2'),formatNumber(outputs('Get_Thursday_Date'), '#nd'),if(endsWith(string(outputs('Get_Thursday_Date')),'3'),formatNumber(outputs('Get_Thursday_Date'), '#rd'),formatNumber(outputs('Get_Thursday_Date'), '#th'))))))

 

5. Add Compose action, name it as "Get Month" and configure below expression

formatDateTime(addDays(utcNow(),2),'MMMM')

 

6. Add Compose action, name it as "Combine Date for subject" and configure below expression. The output of this action is the subject line you need. so use output of this action in the email action

concat('Weekly Report (',outputs('Get_Wednesday_Date_Ordinal') ,' and ', outputs('Get_Thursday_Date_Ordinal'), ' ', outputs('Get_Month') ,')')

 

Full flow screenshot

annajhaveri_0-1623233627229.png

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

Amanstv
New Member

Thank you so much. It did the trick. Cheers!

Thank you so much. It eased my burden fully. Hats off!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (3,105)