cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DLoweinc
Regular Visitor

SharePoint Create Item - Two Conditions from Different Places?

Is there a way to have the condition logic be looking at a second place in addition to the associated SharePoint list?


For example: I would like the Flow to create an item if a field value equals Yes. I want this to run on Created/Modified. But what I don't want it to do is create an item each time the item is modified, I only want it if it doesn't exist.


So how can I write the logic where

 

'check if this value is yes' = Yes (sitecollection1\site1\list1)

 

AND

 

'IDofItemFromSite1' doesn't exist in (sitecollection1\site2\list1)

 

If are true, create a new item in list.

I used to be able to do this with SharePoint designer, but now that my lists are in different sites and I have to use MS Flow, I'm not sure how to accomplish this, or if it is even possible.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @DLoweinc,

 

If the create item action is used for another SharePoint List, then there is a workaround to deal with this situation.

For example, the when an item is created or modified is configrued with List 1, and the create item action is used under List 2,

Then we could build the Flow in the following way:

First, add a field under List2 to mark the ID of List1, let us call it MarkID (should be number type),

Second, add a Get items action, specify to List2, click advanced options, under Filter Query, specify the following:

MarkID eq  [ID]

The ID should be the dynamic content from List1.

After that, add a condition, click the advanced option, and copy and paste the following:

@empty(body('Get_items')?['value'])

If the condition evaluates to yes, it means List 2 didn't contain an item created from List1, so we could then add the create item action under the Yes part.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-micsh-msft
Community Support
Community Support

Hi @DLoweinc,

 

Would you please share a screenshot of your flow configuration?

Condition may vary based on the action you would like to work with.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Learning Solutions MS Flow proposed.png

Basically in the condition field where ID is not equal to ID, I want to compare two different list values.

 

Something like:

 

ID is not equal to ID from List 1

 

I just don't know how to change the data source that shows up in the dynamic lookup, or how to write the expression another way.

Hi @DLoweinc,

 

If the create item action is used for another SharePoint List, then there is a workaround to deal with this situation.

For example, the when an item is created or modified is configrued with List 1, and the create item action is used under List 2,

Then we could build the Flow in the following way:

First, add a field under List2 to mark the ID of List1, let us call it MarkID (should be number type),

Second, add a Get items action, specify to List2, click advanced options, under Filter Query, specify the following:

MarkID eq  [ID]

The ID should be the dynamic content from List1.

After that, add a condition, click the advanced option, and copy and paste the following:

@empty(body('Get_items')?['value'])

If the condition evaluates to yes, it means List 2 didn't contain an item created from List1, so we could then add the create item action under the Yes part.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

I spent a few hours attempting to get this to work properly and I have been unable to.

 

When I do the "Get Items" action, which allows me to use logic from my 2nd list, it adds a 'for each' condition automatically.


This means when I added the logic to say "IDfromList1" doesn't exist in "List2", because it is comparing to each item in the list, there are many successful returns, I only want it to successfully return if after going through all items, none of them equal.

 

I'm still attempting to figure this out, your reply has gotten me much farther and shown me some functionality that I didn't know existed, but I cannot yet get it to do what I want.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,389)