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 / How to check if an ite...
Power Automate
Unanswered

How to check if an item exists on a SharePoint list

(2) ShareShare
ReportReport
Posted on by 62

I have an EmployeeID field in Microsoft Forms. When the form is submitted, I'd like to check if the EmployeeID exists in a Sharepoint List I've created (Employees table with column name EmployeeID). If it does not exist, Send email to notify me.

 

Any help would be appreciated!

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi sherwintan77,

     

    Please try to add an action “SharePoint – Get items” to get the items in the list, then add a Condition, if the EmployeeID in MicrosoftForms is equal to EmployeeID in SharePoint list, do nothing, if no, send you an email.

     

    Hope this works for your scenario. Please try it on your side to see if it will work for you.

     

    Best regards,
    Mabel Mao

  • sherwintan77 Profile Picture
    62 on at

    Hi Mabel,

     

    Thanks for your response. I did that but I get a bad request in Get Items:

     

    Spoiler (Highlight to read)
    Outputs
    Status code
    400
    Headers
    {
      "Pragma": "no-cache",
      "x-ms-request-id": "f94641b8-7d25-4dfa-884f-71f238b0f45a",
      "Timing-Allow-Origin": "*",
      "Cache-Control": "no-cache",
      "Date": "Fri, 29 Sep 2017 19:55:23 GMT",
      "Set-Cookie": "ARRAffinity=1c9e178b01a7edf5c61dddca8a1b25611827b36b00452aca3fbb81b8878998b1;Path=/;HttpOnly;Domain=sharepointonlineconnectionprovider-westus.tip0-westus.p.azurewebsites.net",
      "X-AspNet-Version": "4.0.30319",
      "X-Powered-By": "ASP.NET",
      "Content-Length": "381",
      "Content-Type": "application/json; charset=utf-8",
      "Expires": "-1"
    }

    Body
    {
      "status": 400,
      "message": "The query is not valid.\r\nclientRequestId: f94641b8-7d25-4dfa-884f-71f238b0f45a",
      "source": "https://mycompany.sharepoint.com/sites/teamstan/_api/SP.APIHubConnector.GetListItems(listName='a34b9222-f4f2-40d1-9b4d-0de2e5f087fb',queryOptions=@q)?@q='%2524filter%3d123456'",
      "errors": [
        "-1",
        "Microsoft.SharePoint.SPException"
      ]
    }
    OutputsStatus code400Headers{  "Pragma": "no-cache",  "x-ms-request-id": "f94641b8-7d25-4dfa-884f-71f238b0f45a",  "Timing-Allow-Origin": "*",  "Cache-Control": "no-cache",  "Date": "Fri, 29 Sep 2017 19:55:23 GMT",  "Set-Cookie": "ARRAffinity=1c9e178b01a7edf5c61dddca8a1b25611827b36b00452aca3fbb81b8878998b1;Path=/;HttpOnly;Domain=sharepointonlineconnectionprovider-westus.tip0-westus.p.azurewebsites.net",  "X-AspNet-Version": "4.0.30319",  "X-Powered-By": "ASP.NET",  "Content-Length": "381",  "Content-Type": "application/json; charset=utf-8",  "Expires": "-1"}Body{  "status": 400,  "message": "The query is not valid.\r\nclientRequestId: f94641b8-7d25-4dfa-884f-71f238b0f45a",  "source": "https://mycompany.sharepoint.com/sites/teamstan/_api/SP.APIHubConnector.GetListItems(listName='a34b9222-f4f2-40d1-9b4d-0de2e5f087fb',queryOptions=@q)?@q='%2524filter%3d123456'",  "errors": [    "-1",    "Microsoft.SharePoint.SPException"  ]}

    Not sure what I'm doing wrong. 😞

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @sherwintan77,

     

    Can you please post screenshots of your Flow steps?

     

    Thanks.

  • sherwintan77 Profile Picture
    62 on at

    Sorry, here you go:

    SAP ID is the employee ID.SAP ID is the employee ID.screenshot2.pngscreenshot3.png

     

     

  • sherwintan77 Profile Picture
    62 on at

    Ok I got his to work. Instead of just simply adding a condition, I specifically added an 'Apply to Each' from the 'More' option.

     

    So basically my flow is this:

    • When a new response is submitted (Preview)
    • Get Items
    • Apply to Each
    • Set Output Value from Get Items value
    • Condition: [SAP from When a new response is submitted (Preview)] is equal to [SAP from Get Items]
    • If Yes Do Nothing
    • If No, Send Email

    Now my problem is:

     

    When I run the flow, 100 emails are sent. Does this mean it goes through each record then fires an email if the condition is false?

    How do I make it so it will only fire an email when it has gone through all the records and [SAP] still does not exist?

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @sherwintan77,

     

    Based on the SAP information, how many items are you expecting to retrieve from the Get items step? Is this a SAP list that just contains a record per SAP, or is it a list that contains the specific SAP multiple times? If you can provide information on your list structure, that can help us see a better picture of your requirements.

     

    Thanks,

     

    Fausto Capellan, Jr

  • sherwintan77 Profile Picture
    62 on at

     

    Hi Fausto,

     

    I made some changes and got most of it to work except just one part.

     

    First, here's how my tables (as lists in Sharepoint) look like.

    table relationship.png

     

     

     

     

     

     

     

     

     

     

    And this is the flow.

     

    Sirius SBS form should populate the SBS Sharepoint List. But I need it to check if SAP exists in the Masterlist table.Sirius SBS form should populate the SBS Sharepoint List. But I need it to check if SAP exists in the Masterlist table.If there's a match, Create Item in SBS list then Send Confirmation Email. If there are no matches, then Send Failure Email. The problem is that Send Failure Email is not working.If there's a match, Create Item in SBS list then Send Confirmation Email. If there are no matches, then Send Failure Email. The problem is that Send Failure Email is not working.

     

     

     

     

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @sherwintan77,

     

    What's the error message you are getting on that step? Can you please post it when you have a chance?

     

    Thanks,

    Fausto Capellan, Jr

  • sherwintan77 Profile Picture
    62 on at

    That's what's interesting because there are none. See below.screenshot4.pngI did notice though that the values are empty. See red arrows.I did notice though that the values are empty. See red arrows.

     

     

     

     

     

  • faustocapellanj Profile Picture
    1,662 on at

    Hi @sherwintan77,

     

    On my end, I set up the lists the same way you have them and created the flow. I am now waiting for the Forms flow to trigger; I read there's a one-hour delay for the flow to trigger from the Forms connector. I will keep you posted once the flow runs.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard