cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cs024
Frequent Visitor

Update Item if It Exists

hi there,

 

So I have a rather odd ask for help.

I have a flow that updates one list based on updates in another list. They are linked via a common ID. 

My flow runs and it "works" - it goes and finds the corresponding ID in the list and updates it. BUT I know my flow is wrong and I'm trying to understand why it works and how I can make it 'right'. I don't want it to just work, I want it to be right too. So I'm hoping one of you guys can help me figure out what to 'fix' so it makes sense.

Here is my flow:

cs024_0-1614831980996.png

cs024_1-1614832019799.png

cs024_2-1614832053683.png

I need it to update the item IF it exists BUT if I put it in the "Yes" part it never gets called as the output is always 0. 

Weirdly enough, in the "no" section it does update the right ID and seems to work. But I know that's not the proper way to do this.

 

Can someone please tell me what I did wrong and help me fix it?
Thank you for your time!

J

 

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Community Champion
Community Champion

Hi @cs024 

 

I've put together the same solution as you and the condition works in that the length returns 1 as the number of elements in the get items step.

 

DamoBird365_1-1614851368631.png

 

DamoBird365_0-1614851240861.png

 

Can you take a look at the history of one of your runs and grab a copy of the output from the get items and I will try and help you get up and running.  I think your logic looks OK.

 

Damien

View solution in original post

5 REPLIES 5
DamoBird365
Community Champion
Community Champion

Hi @cs024 

 

I've put together the same solution as you and the condition works in that the length returns 1 as the number of elements in the get items step.

 

DamoBird365_1-1614851368631.png

 

DamoBird365_0-1614851240861.png

 

Can you take a look at the history of one of your runs and grab a copy of the output from the get items and I will try and help you get up and running.  I think your logic looks OK.

 

Damien

View solution in original post

cs024
Frequent Visitor

Thanks Damien.


Here is the output from Get Items:

{"statusCode":200,"headers":{"Transfer-Encoding":"chunked","Vary":"Origin,Accept-Encoding","X-SharePointHealthScore":"3","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","SPClientServiceRequestDuration":"56","SPRequestGuid":"e5d67cf9-fa8b-4d82-8a3d-558cd119d949","request-id":"e5d67cf9-fa8b-4d82-8a3d-558cd119d949","MS-CV":"+XzW5Yv6gk2KPVWM0RnZSQ.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","Content-Security-Policy":"frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.stream.azure-test.net *.microsoftstream.com;","MicrosoftSharePointTeamServices":"16.0.0.21017","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"max-age=0, private","Date":"Thu, 04 Mar 2021 04:13:42 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Type":"application/json; charset=utf-8","Expires":"Wed, 17 Feb 2021 04:13:43 GMT","Last-Modified":"Thu, 04 Mar 2021 04:13:43 GMT","Content-Length":"12"},"body":{"value":[]}} 

INPUT

Inputs

0

 

OUTPUTS

Outputs

0

 

I think maybe it is my filter query that is the issue?

 

Filter Query

Order_x0020_ID eq '60102003'

 

The "Order ID" is a lookup field in that list. And the right side of the "eq" is also a lookup value but I did grab its "Value" field from the dynamic content. Is there some format I need to do?

 

Thank you for your help.

J

 

hi Damien,

 

It turns out it was my filter condition that was the issue and that flow doesn't support lookup in the OData query.

My solution was to use a filter array instead of the Get Items filter query.

 

Thank you for replying to my thread though. It was really late last night when I typed my question and I couldn't think anymore.

Have a good day!

J

DamoBird365
Community Champion
Community Champion

I'm still a bit confused by this to be honest.  If your query is Order_x0020_ID eq '60102003', does it work if you type literally just that?  Without the dynamic value?  I wonder if you need to take a look at what your dynamic value appears as - use a compose temporarily and see what is retrieved.


Damien

cs024
Frequent Visitor

I read somewhere that Lookup values are not supported in flow? Order_x0020_ID is actually a lookup field and I think that's why the result is always 0. So I added a "Filter Array" instead. I'm new to this so still learning and I thank you for your input and help. 🙂

 

 

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,277)