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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / LookUp Inside Patch In...
Power Apps
Answered

LookUp Inside Patch Inside ForAll With Multiple Conditions

(0) ShareShare
ReportReport
Posted on by 81

Hey!

I'm having an issue with patching old records from a combobox. 

This is my current code that isn't working its giving a network error code at the lookup 

 

 

 

ForAll(
 ComboBoxAssets_1.SelectedItems As _item,
 Patch(
 [@'Asset Trackings'],
 LookUp(
 [@'Asset Trackings'],
 _item.Asset = AssetLookup.Asset && 
 IsBlank('End Date')),
 {
 Active: 'Active (Asset Trackings)'.Yes,
 'End Date': DatePickerStart_4.Value
 }
 )
);

 

 

 

It runs without errors if I remove one of the two conditions, doesn't matter which one. (obvsly grabs the wrong record)

I'm fairly sure I'm allowed to have && in there.

🙂

Thanks for any help!

 

 

 

 

Categories:
  • Verified answer
    TrevorMorrice Profile Picture
    81 on at

    I figured out a solution, 

    Had to create another collection, and do the conditions in there instead? 

    Clear(OldAssets);
    ForAll(
     ComboBoxAssets_1.SelectedItems As _item,
     Collect(
     OldAssets,
     LookUp(
     [@'Asset Trackings'],
     AssetLookup.Asset = _item.Asset && IsBlank('End Date')
     )
     )
    );
    ForAll(
     OldAssets As _item,
     Patch(
     [@'Asset Trackings'],
     _item,
     {'End Date': DatePickerStart_4.Value}
     )
    );

     

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @TrevorMorrice ,

     

    I'm not sure where things are going wrong but I hope that there aren't multiple record based on your filter in Lookup

    Basically, Lookup is used to catch 1 record and not multiple, in this case you are looping each item & those should have 1 Item lookup based on condition provided.

    ForAll(
     ComboBoxAssets_1.SelectedItems As _item,
     With(
     {
     ItemRecord: LookUp('Asset Trackings', _item.Asset = AssetLookup.Asset && 'End Date' = Blank(), ThisRecord)
     },
     Patch(
     'Asset Trackings',
     ItemRecord,
     {
     Active: 'Active (Asset Trackings)'.Yes,
     'End Date': DatePickerStart_4.Value
     }
     )
     )
    );

     

    Hope this code helps also you can directly use "yes" instead of choice enum for Active.

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard