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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

(MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

(0) ShareShare
ReportReport
Posted on by 97

I have a flow that creates a new item for a form submission if the date in one of the columns is Tuesday - Saturday and send the form details to a shared inbox as an email is the column date is Monday or Sunday. This is working nicely. However, I also need to add in a second condition for if sent Tuesday - Saturday that check if there are existing items in the same SharePoint list and counts how many for the same column date (i.e. over 6 then send email, if 6 or under then add item to SP list).

 

I have tried adding in a new condition but I can't see how to add the criteria as this a check on data in the SharePoint List and not a check on the form data. 

 

How do I add steps in that will allow for the SP list data to be referenced for the condition query?

 

Thanks in advance for your help!

I have the same question (0)
  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    So - if date is Tuesday - Saturday, AND there are over 6, send email.

    If the date is Tuesday - Saturday, AND there are under 6, add item to SP list.

    Your first step will remain the same, whatever you're doing now to determine the dates.

     

    Then, you'll just use "Get Items" and use the Filter Query on the SHarePoint list, something like ColumnDate eq 'Dynamic Content From Form' (where 'dynamic content from form' is the date you're referencing in the form.) 

    Next, you'll use a condition, with "length()" looking at the Output from the Get Items. This will count how many items you've returned. So if length() is greater than or equal to 6, go down the "Yes" path and send an email. If no, go down the "No" path and Create SP List Item.

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Thanks @Rhiassuring . Unfortunately I can't get the query filter right on Get Items step. I've tried ColumnDate eq '[date field]' but the flow is failing. Any suggestions on what else I can try for the query filter to link together the date field from the form to the date field in the SP list?

     

    h_dunnehowrie_0-1700660849901.png

     

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Sorry, I meant to add that I have added in the exact name of the SP list column, so my line in filter query is currently -

     

    [date column] eq '[form date field value]'

     

    I just realised the above screen shot is misleading.

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    @Rhiassuring Sorry, got it to work now by using Title instead of Date (as this column is also the title column). However, the issue I'm currently having is the second condition. This is the condition line currently

    h_dunnehowrie_1-1700665781682.png

     

    h_dunnehowrie_0-1700665717179.png

    Thanks in advance! I can't work out what I'm doing wrong... my SP list column is Date and it's also the Title column.

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Hi @Rhiassuring  I've also tried with length(outputs('Get items')) but has the same failed result.

     

    h_dunnehowrie_0-1700667830841.png

     

  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Try this: 

     

    length(outputs('Get_items')?['body/value'])
  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Hi @Rhiassuring, thanks for this. Unfortunately, same results - 

    h_dunnehowrie_0-1700734087914.png

     

    nothing included although the criteria on the test was met. The fact that neither options were successful tells me there is still something I am doing wrong...

     

  • Rhiassuring Profile Picture
    8,690 Moderator on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    The issue here isn't your condition, it's that your Get Items is coming back empty. So let's focus in on your filter query there.

    You'd said earlier that it was working out - has it been changed since then? 

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    Thanks @Rhiassuring. Yes, I can see that is correct as I just checked and 0 output from get items. So, I think I thought it was working as no errors, but there is no data being returned. I thought perhaps it was still the issue as the column with the date being the title column but I tried to run get items with a different column (with duplicate dates) but this also retrieved 0 outputs. 

  • h_dunnehowrie Profile Picture
    97 on at
    Re: (MS Forms > SharePoint List) Condition which checks and counts for existing items in a SharePoint list

    @Rhiassuring  I've just realised something. It is correct that for some branches no results would be returned as what we want to happen is if there are existing items in the SP list which match the date over a certain limit (6) then we want an email sent, but if under 6 then it may well be that there are no items in the SP list that match at all. That is what we want. So, the extra logic we want is if there is under 6 OR is no records matching the criteria in 'get items' then create item in SP list. I tried changing the true/false to this so that the logic could include if no items in get items selection, but it didn't work - 

    h_dunnehowrie_0-1700746486844.png

    *changed criteria to 12 as this is what's actually needed and not 6 now...

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 797 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 425 Moderator

#3
developerAJ Profile Picture

developerAJ 319

Last 30 days Overall leaderboard