Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to fix this delegation error?

(0) ShareShare
ReportReport
Posted on by 345

Hi all!

 

I've managed to get rid of all the delegation warnings in my app through the use of collections, better filters etc. I'm stuck on one though!

 

ClearCollect(
 submittedRecords,
 ForAll(
 'TA Gallery Add Delivery Styles'.AllItems,
 Patch(
 'Unit List',
 Defaults('Unit List'),
 {
 'User Name': 'TA - Value - Name'.Text,
 'MMU ID': 'TA - Value - ID'.Text,
 'Unit Name': 'TA - Value - Unit Name'.Text,
 'Unit Credits': Text('TA - Dd - Unit Credits'.SelectedText.Value),
 'Delivery Style': Text('TA - Dd - Delivery Style'.SelectedText.Value),
 'Hours per Session': Value('TA - Value - Hours'.Text),
 'Number of Sessions': Value('TA - Value - Sessions'.Text),
 'Teaching Hours': Value('TA - Value - Pre Total Hours'.Text),
 'Prep Hours': Value('TA - Value - Pre Total Sessions'.Text),
 'Academic Year': Text('Admin - Dd - Academic Year'.SelectedText.Value)
 }
 )
 )
);
Patch(
 'Unit List',
 LookUp(
 'Unit List',
 ID = First(submittedRecords).ID),
 {
 'Number of Students': Value('TA - Value - # Students'.Text),
 'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text)
 }
);

To summarise the above, I generate a collection of records that I submit, and patch them over to my SP list. However, as you can add multiple enteries under the same record title, I only want my "Number of Students" and "Assessment Allocation" to be copied once, so that when I report, I won't have the remove the duplicate values. 

 

However, when I send those single records here:

 

Patch(
 'Unit List',
 LookUp(
 'Unit List',
 ID = First(submittedRecords).ID),
 {
 'Number of Students': Value('TA - Value - # Students'.Text),
 'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text)
 }
);

The lookup for the record ID brings back a delegation warning. My only thought is that either its the usage of First, or that the arguments are different types? This is the offending line. The equals and the .ID are the ones with warnings:

 

ID = First(submittedRecords).ID)

 

Can anyone help please?

  • Verified answer
    timl Profile Picture
    34,963 Super User 2025 Season 1 on at
    Re: How to fix this delegation error?

    Hi @EpicTriffid 

    I would try storing the ID value in a variable, and then referring to that in your call to LookUp. Perhaps that might resolve the problem.

     

    Set(FirstSubmittedID, First(submittedRecords).ID);
    Patch( 'Unit List', LookUp( 'Unit List', ID = FirstSubmittedID, { 'Number of Students': Value('TA - Value - # Students'.Text), 'Assessment Allocation': Value('TA - Value - Assessment Allocation'.Text) } );

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

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard