Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Run query against dataset, check to see if row exists in SharePoint list before creation

(0) ShareShare
ReportReport
Posted on by 111

Hi, I'm having an issue with my flow where I'm unable to figure out how to check to see if a row exists within the SharePoint list i'm creating to.

 

Problem with my flow is, I am getting my data from a JSON array.

 

This is my flow currently below. Steps are as follows:

  • Run a query against the data set.
  • Store the data in a var (Which is an array)
  • Parsing the JSON that comes out of the Var.
  • I'm then doing a CheckContains  contains(outputs('Parse_JSON'))

 

Does anyone have any ideas? Or a solution they are willing to share? 

 

Albertax_0-1700603051883.png

 

  

  • Verified answer
    Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: Run query against dataset, check to see if row exists in SharePoint list before creation

    Ah - you want to look at the length of the values, not the body.

    Like this: 

     

    length(outputs('Get_items')?['body/value'])
     
    Rhiassuring_0-1700607859677.png

     

     

     




  • Albertax Profile Picture
    111 on at
    Re: Run query against dataset, check to see if row exists in SharePoint list before creation

    Thanks again for your help, please see screenshot

    Albertax_0-1700607217848.pngAlbertax_1-1700607245806.png

     

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: Run query against dataset, check to see if row exists in SharePoint list before creation

    Are you able to show me a screenshot of your flow in configuration mode? (So I can see the expressions used, and references.)

  • Verified answer
    Albertax Profile Picture
    111 on at
    Re: Run query against dataset, check to see if row exists in SharePoint list before creation

    Greatly appreciate your response. I seem to be getting an error: 

     

    Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#length for usage details.'.

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: Run query against dataset, check to see if row exists in SharePoint list before creation

    So the goal is to create a new item in SharePoint if the row from your data set does not exist in SharePoint?

     

    What is the key between the data? Would it be identical titles? You will need to do a "Apply to Each" (as you are) on the "Title" from the JSON output, on a "Get Items" action for SharePoint, where Filter Query = Title eq 'JSON Title Output'. Then you can do a length() on the output from that, to identify if you've retrieved anything or not. If the length() is equal to 0, then that means you need to create the new item. If the length is not 0, then the item already exists.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,587 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow