cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vidarv
Helper I
Helper I

Filter condition in PowerAutomate

Hi,

I have created a flow that is getting data from MessageCenter and puts the data in a SharePoint list called MessageCenterData.
What I am trying to do is each time the flow is running, it will check if there is a new message, or if an old message is updated and then update the data or create new data in SharePoint list.

I am trying to create a condition, but I am out of ideas.

Here is the flow

vidarv_0-1642111516554.png

Can someone please help me ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
vidarv
Helper I
Helper I

Thank you for your help

I was collecting my data from ms graph as a json input. Some of the data has several input on the same string. To collect all the data as an array , I created a join in the Output and put it in a SharePoint list. I then created a new SharePointlist with the same data, used Get Items, used Id as a uniqe Identificator and the condition 

length(outputs('Get_items')?['body/value']). The flow now runs evry morning and collect just the data i want.

View solution in original post

5 REPLIES 5
Mira_Ghaly
Dual Super User II
Dual Super User II

@vidarv 

Can you please check my blog article on how exactly to check if there is an existing item already on sharepoint , so either create if does not exist or Update if it exists.

https://onlinemgblog.wordpress.com/2021/05/29/building-flows-1-check-if-item-exist-and-update-if-exi...

Let me know if you need more help on this!

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here
abm
Super User
Super User

Hi @vidarv 

 

To decide the record is exists or not in SharePoint you need to use the Filter Query of Get Items. Have you got any unique value for each record. Using this you could filter the record. 

 

 Please see below

 

image.png

 

Above I am checking the record count for the relevant record exists or not.

 

The expression is as follows:

 

length(body('Get_items')?['value'])
 
Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
vidarv
Helper I
Helper I

Thank you for your answers @abm @Mira_Ghaly 

I can’t get your tips to work.

The data is collected from ms graph send to parse json and thereafter to select. After data is collected to SharePoint list the first time and the flows run each day it will discover new items, som items has changed dates another items has changed the title but Id is unique. If Id is unique but lastupdated date has changed all the fields has to changed to the new fields from select output. There can be new Id and fields that has changed values.

Hope this make it more clear. 

Hi @vidarv 

 

Check the schema generated is correct. When you generate the schema it may fail with string/null error. So update the schema with ["string", "null"] under the parse JSON step. Add the Get Items to filter the query. Check the condition for record exists or not. Then add Create or Update item.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
vidarv
Helper I
Helper I

Thank you for your help

I was collecting my data from ms graph as a json input. Some of the data has several input on the same string. To collect all the data as an array , I created a join in the Output and put it in a SharePoint list. I then created a new SharePointlist with the same data, used Get Items, used Id as a uniqe Identificator and the condition 

length(outputs('Get_items')?['body/value']). The flow now runs evry morning and collect just the data i want.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,357)