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 / Saving Lookup Field Po...
Power Apps
Answered

Saving Lookup Field Populated from Collection

(0) ShareShare
ReportReport
Posted on by 217 Season of Giving Solutions 2025

I have a canvas app and a SP list, on the list is a Lookup field to another list.  

The problem i am having is getting the value to come from a collection and save to the Lookup field;

 

 

ClearCollect(
 myTemplate,
 ThisItem.'Grade Name'.Value, //Lookup field 
);

 

I have this in the update for the lookup field;

 

{Value:DataCardValue1.Selected.'Grade Name',
Id:
LookUp('Grades & Grade Names','Grade Name' = DataCardValue1.Selected.'Grade Name').ID

}

 

   If the user just selects a value this will work and save, however if the field value gets populated from the collection then nothing saves. 

This is the DefaultSelectedItems

 

Last(FirstN(myTemplate, 1))

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,750 Most Valuable Professional on at

    Hi @CiaranCampbell ,

    Your DefaultSelecteditems is the issue - you are missing the Id field in your collection - I am not sure why you are using a Collection here but it should simply be the target field

    ThisItem.'Grade Name'

    Also your Items could much easier be

    Choices(SPListName.'Grade Name')

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

  • senna Profile Picture
    217 Season of Giving Solutions 2025 on at

    Hi @WarrenBelz 

    I'm using a collection as the users want a way to populate all/some fields based on a previous submission, so i let them choose what submission and save all the values from it to a collection to populate the blank form.

    I have removed the .Value, thanks

     

     

    In my Items i have this;

     

    Filter('Grades & Grade Names',Grade.Value=DataCardValue58.Selected.Value)

     

     This is so the user can filter the lookup field as it is a large amount of values

     

    "'Grades & Grade Names'" is the name of the list the lookup references.

    Unfortunately I'm stuck here with the functionality working if the user simply selects something from the dropdown but not if the value is coming from the collection

     

     

    EDIT: Just to further complicate it, if i remove .Value from my clear collection, then i get [ojbect][object] and not the value displayed on the form

  • WarrenBelz Profile Picture
    156,750 Most Valuable Professional on at

    @CiaranCampbell ,

    This would be far easier if you did not use Lookup columns (I never use them) as they are generally unnecessary unless you want to use them directly in SharePoint Edit in grid view. You could do exactly what you are doing here with the collection and simply write the output back to a Text field.

    Before I do anything here, can you please consider this structure as the alternative gets quite complex, in particular I am struggling with how your collection can contain one record

    ClearCollect(
     myTemplate,
     ThisItem.'Grade Name'.Value, //Lookup field 
    );

     

  • senna Profile Picture
    217 Season of Giving Solutions 2025 on at

    Thanks @WarrenBelz 

    Understand the reluctance to use Lookups and this is probably a good example why people don't, but the reason for us using a lookup is its a list of grades than will need to be updated regularly as new ones are added and old ones are removed, it will also be used by a few different apps so having a centralized list just for this data was seen as a good solution. 

    Regarding the collection, there is about 50 items, i just removed the rest to keep it tidy for the example code 

  • WarrenBelz Profile Picture
    156,750 Most Valuable Professional on at

    Hi @CiaranCampbell ,

    The point about the lookup column was you can do the same thing in Power Apps by simply having the Items of the drop-down directly pointing at the other list field instead of the lookup field. If you still need the collection, keep it, but make the Items

    Choices(
     YourSPListName.'Grade Name'
    )

    and the Id will be there to Patch.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

     

     

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 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard