web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Records won't update i...
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?
Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    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}
     )
    )

     

  • Chlopky Profile Picture
    8 on at

    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".

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    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

    Unfortunately both of these give me same fetch error.

  • IonutHzd Profile Picture
    87 on at

    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

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard