Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

ForAll Patch Issue

(0) ShareShare
ReportReport
Posted on by 71
I am having issues with patching a collection value into Dataverse lookup column.
 
1st i have a gallery which the user can select multiple assets from a dataverse table called Assets
 
 
2nd once they select multiple assets they are taking to an Asset Booking screen with a dataverse table called Asset Bookings where they select the start and end date

 
Finally i want the "Book All Assets button to loop through a for all and apply the start and end date to each selected asset and create a new line in the Asset Bookings table but i cant get the formula to apply the Asset ID into the lookup column

I have this so far, i've been stuck for so long, can anyone please help???
 
ForAll(
    selectedAsset //MY COLLECTION TAKEN FROM THE ASSET GALLERY
     As BOOKINGS,
    Patch(
        'Asset Bookings', //MY ASSET BOOKING DATAVERSE tABLE
        Defaults('Asset Bookings'),
        {
            Asset: // THE THING I CANT GET TO WORK
 
            'Booking Date': PBStartDate.SelectedDate,
            'Return Date': PBEndDate.SelectedDate,
     
       
        }
    )
);
  • Suggested answer
    LessCodePaths Profile Picture
    100 on at
    ForAll Patch Issue
    Hi,
     
    to patch dataverse lookup column you need to use object matching related table.
    I assume that selectedAssets is collection which holds objects matching related table.
     
    Formula should work:
    ForAll(
        selectedAsset //MY COLLECTION TAKEN FROM THE ASSET GALLERY
         As BOOKINGS,
        Patch(
            'Asset Bookings', //MY ASSET BOOKING DATAVERSE tABLE
            Defaults('Asset Bookings'),
            {
                BOOKINGS, 
                'Booking Date': PBStartDate.SelectedDate,
                'Return Date': PBEndDate.SelectedDate,
            }
        )
    );
    
    
    Let me know if it helps.
    L.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard