web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Setting Automatic Repl...
Power Automate
Answered

Setting Automatic Reply (OoF) based on Shifts

(0) ShareShare
ReportReport
Posted on by 21

Hi everyone! I was wondering if someone could help me set my Automatic Replies based on where my shift is based.

 

We currently have 4 options in our shifts - Home, Office, Leave, Sick

 

What I have at the moment is:

 

1. Repeat the trigger everyday at midnight

Screen Shot 2021-03-11 at 11.13.18 am.jpg

 

2. Get my profile

Screen Shot 2021-03-11 at 11.13.54 am.jpg

 

3. Get the current date and time

Screen Shot 2021-03-11 at 11.13.59 am.jpg

 

4. List all the shifts

Screen Shot 2021-03-11 at 11.14.10 am.jpg

 

I was following this forum post: https://powerusers.microsoft.com/t5/General-Power-Automate/Get-my-shifts-using-flow/m-p/384718/highlight/true#M37964 but couldn't seem to get past the Select area.

 

I think that in the list shifts (step 4) I would pass in the Start Datetime from step 3.

 

Then I would parse the JSON.

 

Filter the array for both User ID and then get the next day entry.

 

If it matched "Leave" or "Sick", then set the Automatic Reply action - start time and end time of the shift.

 

Any help would be appreciated!

Categories:
I have the same question (0)
  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @__markb 

     

    You'll need to ensure that your date is in the correct format first, and can look to use the expression formatdatetime().  I had a case a few weeks ago where by adding a date, the filter returned nothing, my environment is still behaving the same but the affected user rebuilt his flow and it finally worked - I think it's maybe a bug so something to watch for.

     

    DamoBird365_0-1615444403269.png

    Anyway, once you have listed all of your shifts, you need to filter.  The get shifts action doesn't make thing easy for you as it doesn't return the shift user in the body, instead you get the GUID for that User which can be obtained with another action get user profile.

    1234.PNG

     

    Once filtered you can apply a condition on the top "Notes" field?  Take a look at the body output of a history run to discover the field you are looking for but something as follows:

     

    "sharedShift": {
    "notes": "Office",
    "startDateTime": "2021-03-04T07:15:00Z",
    "endDateTime": "2021-03-04T16:15:00Z",
    "theme": "blue",
    "activities": []
    }

     

    Your top shift returned in your filter array (assuming more than one) will be equal to the expression:

    body('Filter_array')?[0]?['sharedShift']?['notes']

     

    You can use the condition action on this.

     

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

  • NetworkNerd Profile Picture
    2 on at

    I was trying this out and noticed that the results returned didn't actually include any shifts that are away.  It seems to only return shifts where they're either blue or green.

     

    I'm not 100% sure but it seems like the only way to get AWAY times is to user "List all Time Off Instances".

  • __markb Profile Picture
    21 on at

    @NetworkNerd you're correct, I've noticed only shifts which detail you are working come up in the array. I usually have a condition that if the array is not empty then there is a shift, otherwise it would be a day off (because not all weekends are days off).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 248 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 207 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 101 Super User 2026 Season 1

Last 30 days Overall leaderboard