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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Teams Adaptive Card to...
Power Automate
Answered

Teams Adaptive Card to Outlook Event Conditional On Already Occurring Events?

(0) ShareShare
ReportReport
Posted on by 12

Hello all,

 

I do apologize if this is a stupid question, I have just started learning!

 

I'm trying to create a flow that will allow my users to create an outlook event through an adaptive card. This is for the purposes of booking equipment, so the adaptive card contains data-fields to put in the type of equipment, their initials, location, the date and start and end times of the booking. 

 

So far this is what I have; The user messages a teams channel, flow posts a adaptive card in the channel, they enter the details, click submit and it will create an event with the event drawing details from the card; the equipment, initials and location being combined into the subject of the event and the date being combined to the start and end times respectively. This works perfectly. 

 

What I'd really like to do is have the flow check if there is a pre-existing event with the equipment name in the subject and that takes place at the same time and date and create the event if there is not one, or return a message in the teams channel if there is one and not create the event.

 

I have tried using both Get Events V4, which pulls every event into an array, and get calendar view of events V3 which I've tried using to pull events from the specific time entered in the card (Using the DateTTime Format) but my conditional branches don't seem to like either of these. Get events seems to check every event in the array for conflicts and creates a new instance of my event for each one and and if Get calendar view has an array with nothing in it, it doesn't run through the rest of my flow. Does anyone have any ideas?  

 

This is my flow that works:

Working FLow.png

 

Categories:
I have the same question (0)
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @DanDy 

     

    Please share your flow screen of second part where you used get events and use condition. it will help us to give you proper solution.

     

    Thanks

    Hardesh

  • DanDy Profile Picture
    12 on at

    Hi Hardesh, thanks for the response. 

    Help3.png

    What I've done is tried to pull events at the time that the user would input into the adaptive card, and then compare the event to see if they want to book the same equipment at the same time as someone else, if they do the flow will send a message saying "Sorry these ae booked." Otherwise it will create the event. I think can see why this isn't working, but please do tell me if I'm wrong, my understanding of this would be that when I put in the get events output into the conditional branch it automatically comes up with an apply to all, and if there are no events for it to apply to, it applies it 0 times instead of creating the event. 

    Any advice to get it working how I intended would be greatly appreciated, as I can't seem to figure it out!

    Many thanks!

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @DanDy 

    Your logic is correct.

    In Condition 2 action you have used laptops, date and start time. please add compose action just above the condition 2 block. it should be inside loop. Then run your flow and share screen of your compose actions output. i want to see what is coming from teams actions.

     

    Thanks

    Hardesh

  • DanDy Profile Picture
    12 on at

    Hi, thanks for the continued support with this. The values you mentioned are from an adaptive card, I will also place the code for this below.

    {
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "type": "AdaptiveCard",
     "version": "1.2",
     "body": [
     {
     "type": "TextBlock",
     "text": "Book Your Laptops Below",
     "weight": "Bolder",
     "size": "Medium",
     "spacing": "Medium"
     },
     {
     "type": "TextBlock",
     "text": "Laptops Needed",
     "wrap": true
     },
     {
     "type": "Input.Text",
     "id": "Laptops",
     "spacing": "None"
     },
     {
     "type": "TextBlock",
     "text": "Period",
     "wrap": true
     },
     {
     "type": "Input.Text",
     "id": "Period",
     "spacing": "None"
     },
     {
     "type": "TextBlock",
     "text": "Initials"
     },
     {
     "type": "Input.Text",
     "spacing": "None",
     "id": "Initials"
     },
     {
     "type": "TextBlock",
     "text": "Location"
     },
     {
     "type": "Input.Text",
     "id": "Location"
     },
     {
     "text": "Date",
     "type": "TextBlock"
     },
     {
     "type": "Input.Date",
     "id": "Date"
     },
     {
     "text": "Start Time",
     "type": "TextBlock"
     },
     {
     "type": "Input.Time",
     "id": "StartTime"
     },
     {
     "text": "End Time",
     "type": "TextBlock"
     },
     {
     "type": "Input.Time",
     "id": "EndTime"
     }
     ],
     "actions": [
     {
     "type": "Action.Submit",
     "title": "Submit"
     }
     ]
    }

    Please find below a compose of the values from the card, this is me inputting test values, I placed this inside the loop.

    Help4.png

    Many thanks.

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @DanDy 

    Thanks for inputs. I will test this and will post my solution later.

     

    Thanks

    Hardesh

  • Verified answer
    Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @DanDy 

     

    you need to use select action after get events and then pass select output in apply to each value. Here i have compared for subject only. in the same way you can do for other comparisons.

    expression to get each item from select output- items('Apply_to_each')['subject'] *Note- here subject is from select 'enter key' not from get events.

    Hardesh15_1-1600785563483.png

     

    try this it will work.

     

    Thanks

    Hardesh

  • DanDy Profile Picture
    12 on at

    Brilliant! Thank you for all the help Hardesh!

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard