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 / Run query against data...
Power Automate
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

 

  

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    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.

  • Verified answer
    Albertax Profile Picture
    111 on at

    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,690 Moderator on at

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

  • Albertax Profile Picture
    111 on at

    Thanks again for your help, please see screenshot

    Albertax_0-1700607217848.pngAlbertax_1-1700607245806.png

     

  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at

    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

     

     

     




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