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

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
yoshihirok
Level 10

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

wiredupjax
Level: Powered On

Re: Work anniversary - send email

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

 

Untitled.png

Community Support Team
Community Support Team

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

wiredupjax
Level: Powered On

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

wiredupjax
Level: Powered On

Re: Work anniversary - send email

Bump

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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 Kudoed Authors
Users Online
Currently online: 207 members 5,427 guests
Please welcome our newest community members: