Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Records won't update in SharePoint list, getting "Fetching items failed" error.

(1) ShareShare
ReportReport
Posted on by 8

Hello,

 

I'm trying to create a renting app for our users. They add some items into gallery and hit "rent"  button. I would like to have my SP list updated in column "DostupneKlice" by -1 when reting.

 

I have this on my rent button: 

ForAll(GalleryScannedKeys.AllItems, Patch(SeznamBytuKarvina,LookUp(SeznamBytuKarvina,Title=ThisRecord.Title,{DostupneKlice: DostupneKlice-1})))
 
No error when I save the app, only after I test it whole LookUp formula gets error: Error when trying to retrieve data from the network: Fetching items failed. Possible invalid string in filter query.
 
I'm assuming the issue lies in this part - Title=ThisRecord.Title - however I tried Title=Title, Title=Gallery.Selected.Title, etc. to no avail.
 
Could someone try to explain what is the issue here?
  • Chlopky Profile Picture
    8 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    I managed to get my Patch function working with this:

     

    Patch(SeznamBytuKarvina,LookUp(SeznamBytuKarvina,Pasport=varPasportNumber), {DostupneKlice: LookUp(SeznamBytuKarvina, Pasport=varPasportNumber).DostupneKlice -1})
     
    However without ForAll function it currently edits only one selected record from the gallery. I created a collection and tried this:
     
    ForAll(colScannedKeys,Patch(SeznamBytuKarvina,LookUp(SeznamBytuKarvina,Pasport=ThisRecord.Pasport), {DostupneKlice: LookUp(SeznamBytuKarvina, Pasport=ThisRecord.Pasport).DostupneKlice -1}))
     
    But I am at square zero with error: Error when trying to retrieve data from the network: Fetching items failed. Possible invalid string in filter query.
  • IonutHzd Profile Picture
    69 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    Hello,

     

    I would suggest using the ID instead of Title. And in situations where you are not sure which column is being used you can use the AddColumns function. You can try something like this:

    ClearCollect(temp, AddColumns(GalleryScannedKeys.AllItems, "Identificator", ID));

    ForAll(
    temp,
    Patch(
    SeznamBytuKarvina,
    LookUp(SeznamBytuKarvina, ID = Identificator, ThisRecord),
    { DostupneKlice: DostupneKlice - 1 }
    )
    );

  • Chlopky Profile Picture
    8 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    Unfortunately both of these give me same fetch error.

  • mmbr1606 Profile Picture
    12,112 Super User 2025 Season 1 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    hey @Chlopky

     

    can u try this:

    ForAll(GalleryScannedKeys.AllItems, Patch(SeznamBytuKarvina, LookUp(SeznamBytuKarvina, Title = Title, {DostupneKlice: DostupneKlice - 1})))
    

     

    or this:

    ForAll(GalleryScannedKeys.AllItems, 
     With({currentTitle: Title}, 
     Patch(SeznamBytuKarvina, LookUp(SeznamBytuKarvina, Title = currentTitle, {DostupneKlice: DostupneKlice - 1}))
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • Chlopky Profile Picture
    8 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    Title = Title doesn't work. I tried GalleryScannedKeys.Selected.Title, this now goes without an error but instead of editing existing record in my SP list and decreasing the number. It creates new record, all metadata is empty except DostupneKlice column which records 1 (see screenshot).

     

    Yellow is the record I was searching for and displaying in my gallery and wanted to decrease, red is new empty record created by clicking button "Rent".

  • anandm08 Profile Picture
    1,936 Super User 2025 Season 1 on at
    Re: Records won't update in SharePoint list, getting "Fetching items failed" error.

    hi @Chlopky ,

    The issue seems to be with how the LookUp function is used inside the Patch function. Specifically, ThisRecord.Title might not be recognized correctly in this context. Instead of ThisRecord.Title, try using GalleryScannedKeys.Selected.Title or referencing the item directly from the ForAll iteration.

     

    ForAll(GalleryScannedKeys.AllItems, 
     Patch(
     SeznamBytuKarvina, 
     LookUp(SeznamBytuKarvina, Title = Title), 
     {DostupneKlice: DostupneKlice - 1}
     )
    )

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard