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

Work anniversary - send email

I have searched the format and compare methods on the net from top to bottom to no avail. I know how to create the flow but I can't figure out the logic to compare MM-DD only.

 

USE CASE: send email when an employee's work anniversary has arrived

 

Thoughts on logic would be:

@Equals(

 item(formatDateTime([hire date],'MM-DD'),formatDateTime(utcnow(),'MM-DD')

)

 

But, I'm just not getting the syntax correct...

 

Any ideas?

5 REPLIES 5
Highlighted
Memorable Member
Memorable Member

Re: Work anniversary - send email

Hi @wiredup

 

1. Can you try 'MM-dd' instead of 'MM-DD' ?

   @Equals( item(formatDateTime([hire date],'MM-dd'),formatDateTime(utcnow(),'MM-dd') )

 

2. Can you show these outputs of formatDateTime?

- output of formatDateTime([hire date], 'MM-dd')

- output of formatDateTime(utcnow(), 'MM-dd')

2018-08-19 (4).png

3. Can you show the RUN HISTORY?

2018-08-19 (3).png

 

Regards,

Yoshihiro Kawabata

Highlighted
Helper III
Helper III

Re: Work anniversary - send email

This is failing for me with "unexpected array" likely due to "get items" (plural)

 

Untitled.png

Highlighted
Community Support
Community Support

Re: Work anniversary - send email

 

Hi @wiredup,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share a screenshot of the run history of your flow when the flow run failed?

Could you please explain more details about the error message?

 

I have made a test on my side and have created a sharepoint list as below:

Capture.PNG

 

I have created a flow as below:

Capture.PNG

 

The expression in the Condition as below:

 

@equals(formatDateTime(items('Apply_to_each')?['hire_x0020_date'], 'MM-dd'), formatDateTime(utcNow(), 'MM-dd'))

 

 

The flow would run successfully as below:

Capture.PNG  

 

Best regards,

Alice

Highlighted
Helper III
Helper III

Re: Work anniversary - send email

Ok, I have this working ... now, I did change MM-dd to MM because I only want to check the MONTH vs. MONTH and day.

 

@and(
 equals(formatDateTime(items('Apply_to_each')?['OData__x0077_q99'], 'MM'), formatDateTime(utcNow(), 'MM'),
 equals(items('Apply_to_each')?['Process_x002d_Status']?['Value'], 'Hired-Complete'),
 not(
 equals(items('Apply_to_each')?['OData__x0077_q99'], 'Null')
 )
))

However, I need to "accumulate" anniversary records and send them in a single email.  I have searched the boards and seen this done in a few ways which may change the implementation.  Some folks have used filter arrays?

 

screen1.pngscreen2.png

Highlighted
Helper III
Helper III

Re: Work anniversary - send email

Bump

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

Top Solution Authors
Top Kudoed Authors
Users online (13,894)