cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Delminium
Helper II
Helper II

Problems Updating SharePoint List using ForAll/Patch

Hello,

 

I am having an issue with some code that used to work but is now giving me errors when I attempt to run it via a button click.

 

The only change I made was to one of my flows. The flow trigger was changed to point to a new SharePoint List. I have tried recreating my button and creating a new flow from scratch.

 

When I click the button, I get the following error message:

 

The requested operation is invalid. Server Response: Order_Details failed: Fetching items failed. Possible invalid string in filter query. clientRequestId: 78beb383-53d2-4351-b4cf-6f54524af010 serviceRequestId: 78beb383-53d2-4351-b4cf-6f54524af010

 

If I remove the code below then I don't have any issues. The code appears to be correct in PowerApps. I am not sure why this is suddenly occurring. Hoping someone else knows!

 

 

ForAll(colOrderDetails,
Patch(Order_Details,LookUp(Order_Details,ID=colOrderDetails[@ID]),
{
    OrderNo:colOrderDetails[@OrderNo],
    LineNo:colOrderDetails[@LineNo],
    ItemNo:colOrderDetails[@ItemNo],
    ItemDescription:colOrderDetails[@ItemDescription],
    QtyOrdered:colOrderDetails[@QtyOrdered],
    QtyReceived:colOrderDetails[@QtyReceived],
    QtyDamaged:colOrderDetails[@QtyDamaged],
    ReceivedBy:If(colOrderDetails[@QtyReceived]<>0,User().FullName,""),
    ReceivedDate:If(colOrderDetails[@QtyReceived]<>0,DateAdd( Now(), 0, Hours ),"")
}
));

 

  Thanks to all in advance!

26 REPLIES 26

@Delminium  found it!! 

 

But can't raise a ticket because I don't have admin rights in the organisation! urgh.

@Helen_BB 

 

I logged a ticket through this URL: https://powerapps.microsoft.com/en-us/support/pro/ticket/

 

I had to be authenticated through my company first before I could submit a ticket.

 

For your issue, could you try something like this?

 

Patch('PDP Objectives',{ID=vGalleryItems[@ID]},

 

Keeping my fingers crossed for you! 🤞

 

 

What am i doing wrong? 😧 

 

ForAll(vGalleryItems,Patch('PDP Objectives',Filter('PDP Objectives',PDP='Current PDP ID'.Text),{ID=vGalleryItems[@ID]}   (invalid argument type expecting a record value type instead) 

 

Any ideas? i might strip the code right back to basic at work from there! 

Hi @Helen_BB 

 

Try this:

 

UpdateContext({vGalleryItems:Gallery3.AllItems});

ForAll(vGalleryItems,
Patch('PDP Objectives',{ID=vGalleryItems[@ID]},
{
    How:vGalleryItems[@Howbox].Text,
    What:vGalleryItems[@Whatbox].Text,
    RAGE:vGalleryItems[@'Rag Employee'].SelectedText.Value,
    RAGM:vGalleryItems[@'Rag Manager'].SelectedText.Value,
    Comments:vGalleryItems[@CommentsBox].Text,
    Empowerment:vGalleryItems[@empowerment].Value,
    Love:vGalleryItems[@'Love our products'].Value,
    Clarity:vGalleryItems[@clarity].Value,
    Dynamic:vGalleryItems[@'Dynamic & Agile'].Value
}
));

 

Not sure how big your collection is but I think it should allow you to update your data source.

Still no luck 😞 

 

the collection would be a max of about 10 records - so nothing mega 

 

UpdateContext({vGalleryItems:Gallery3.AllItems});ForAll(vGalleryItems,Patch('PDP Objectives',{ID=vGalleryItems[@ID]},{How:vGalleryItems[@Howbox].Text}))

 

i'm getting:

  • ForAll - has some valid arguments
  • Patch - has some valid arguments
  • ID=vGal - unexpected characters 😧

@Helen_BB 

 

Can you try something like:

 

UpdateContext({vGalleryItems:Gallery3.AllItems});

ForAll(vGalleryItems,
Patch('PDP Objectives',{ID=vGalleryItems[@ID]},
{
    How:vGalleryItems[@Howbox],
    What:vGalleryItems[@Whatbox],
    RAGE:vGalleryItems[@'Rag Employee'],
    RAGM:vGalleryItems[@'Rag Manager'],
    Comments:vGalleryItems[@CommentsBox],
    Empowerment:vGalleryItems[@empowerment],
    Love:vGalleryItems[@'Love our products'],
    Clarity:vGalleryItems[@clarity],
    Dynamic:vGalleryItems[@'Dynamic & Agile']
}
));

 

I originally create my collection on App start and then connect the collection to the gallery. I then patch my collection any time someone makes an edit in the gallery. When the user is ready to make changes to SP they click on the Update button.

Still no luck 😞 

 

Will speak to the IT team tomorrow and try and get a support ticket logged with Microsoft! 

 

thank you so much for all your efforts 🙂

 

thanks,

H

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,810)