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

When an event is added, updated or deleted duplicate action when an event is accepted

I am using the "When an event is added, updated or deleted (V3)" trigger to send an email notification for events that live on a shared calendar.   This flow also automatically accepts the event for the calendar account when it is added (based on the ActionType condition).

 

This is working great to send an email on any new, removed, or changed event, however it is triggering when the event is added and then immediately again when the event is accepted (which fires as an "updated" trigger).   How can I differentiate this acceptance update and exclude it from the flow so that the email is only sent once on event creation?

 

Is there some variable that represents what is actually changed about the calendar item?

 

Thanks,

Greg

1 ACCEPTED SOLUTION

Accepted Solutions
sss
Community Support
Community Support

Hi  gregkegel,

 

If we want to differentiate this acceptance update and exclude it, we should know what's the differences of the reponse in flow.

1. Get the body context when the event was created and updated

email event.png

2. Compare the text, we found the responseType in the  output is different

email response.png

3. Add a condition after the trigger. If you only send once on event creation, you can set a condition like below.

Condition.png

On event creation, you can add sent email action under 'If Yes'. If the event is updating, the flow skip the ations in 'If Yes' and follow the actiona in 'If no'.

View solution in original post

6 REPLIES 6
sss
Community Support
Community Support

Hi  gregkegel,

 

If we want to differentiate this acceptance update and exclude it, we should know what's the differences of the reponse in flow.

1. Get the body context when the event was created and updated

email event.png

2. Compare the text, we found the responseType in the  output is different

email response.png

3. Add a condition after the trigger. If you only send once on event creation, you can set a condition like below.

Condition.png

On event creation, you can add sent email action under 'If Yes'. If the event is updating, the flow skip the ations in 'If Yes' and follow the actiona in 'If no'.

gregkegel
Frequent Visitor

Thank you for your reply!

 

I tried this initially, but this "responseType" seems to be static after the event is accepted, meaning any future "updates" to the event will still report the responseType as "accepted".   How do I differentiate between an event that is just being updated versus an event that is updated *because* it was accepted?

Ultimately, I worked around this one by comparing the response time to the modified time.   If these were the same (or within a second away from eachother), it can be determined that the "update" is actually the response.

CaSi
Frequent Visitor

@gregkegel I just found your post which was very helpful for me. Can you show me how you compared the response time to the modified time? Thanks a lot!

Hi @CaSi 

 

Not sure if it's the best way, but first I establish some time variables:

gregkegel_4-1648162690333.png

 

I check if Last modified on the event is not null:

gregkegel_2-1648162575954.png

 

if not, then I set variable "timeModified" to:

ticks(triggerBody()?['lastModifiedDateTime'])
 
and "timeDiffAbs" variable to:
sub(variables('timeModified'),variables('timeResponse'))
 
and the difference between these as "timeDifference":
div(variables('timeDiffAbs'),20000000)
 gregkegel_3-1648162606555.png

 

then a condition to check it:
gregkegel_0-1648162409034.png
 
Those 3 look like this:
gregkegel_1-1648162564273.png

 

seems pretty hacky but it worked for my needs. Hope this helps!
 
CaSi
Frequent Visitor

Thanks a lot @gregkegel. This has brought me further. The setting of variables as integers output an error (I think it needs to be string) so I changed the flow a little bit and now it works for me. This is my flow:

 

For the "When an event is added, updated or deleted (V3)" I set the Trigger Conditions under Settings to

 

@equals(triggerOutputs()?['body/responseType'], 'accepted')

 

followed by Convert Time Zone for Response Time and Last Modified Time.

 

CaSi_0-1648225815494.png

 

After that I used an Expression in Compose with 

 

div(sub(ticks(body('ModifiedTime')),ticks(body('ResponeTime'))),10000000)
 
to calculate the time difference in seconds. If this difference is within a certain time range, an email is sent.
 
CaSi_2-1648226634380.png

 


 

Helpful resources

Announcements
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.

Users online (5,159)