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 / ClearCollect not getti...
Power Apps
Answered

ClearCollect not getting DisplayName

(0) ShareShare
ReportReport
Posted on by 2,563

So im trying to get the displaynames in a collection im only getting the claims.

 

ClearCollect(ColSelectedPeople,{Claims: "",Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});Clear(ColSelectedPeople);
ForAll(AddPeople.SelectedItems,Patch(ColSelectedPeople,Defaults(ColSelectedPeople),{Claims:"i:0#.f|membership|" & UserPrincipalName}));

 

My collection only gets the Claims and not the department or DisiplayName and so on.

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @JimmyWork
    I have tested this and the reason is your code was missing several fields in the 3rd argument of PATCH

     

     

    ForAll(
     AddPeople.SelectedItems,
     Patch(
     ColSelectedPeople,
     Defaults(ColSelectedPeople),
     {
     Claims:"i:0#.f|membership|" & UserPrincipalName,
     DisplayName: DisplayName,
     Email: Mail,
     JobTitle: JobTitle,
     Picture: Picture
     }
     )
    );

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • JimmyW Profile Picture
    2,563 on at

    @mdevaney Thank you very much.

    The only part im not able to get to work is the Picture part, if i add that it will give me an error saying Picture is not Text.

    And for email i had to type Mail, if i used Email i got some weird results.

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @JimmyWork 

    I think the Picture field is failing because the code is used to store a "" string initially then later it stores an image.  PowerApps doesn't like doing that.  So maybe you could get away with storing the SampleImage instead of "" initially.

     

    ClearCollect(
     ColSelectedPeople,
     {
     Claims: "",
     Department:"",
     DisplayName:"",
     Email:"",
     JobTitle:"",
     Picture: SampleImage
     }
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • JimmyW Profile Picture
    2,563 on at

    @mdevaney Thank you sampleImage worked.

     

    But im wondering do i need this, because when im patching im patching the sampleimage and i dont want to do that? If i just leave Picture empty what will happend in the end when im patching?

  • mdevaney Profile Picture
    29,991 Moderator on at

    @JimmyWork 

    You initially need SampleImage to define the field as a Picture type but I definitely agree it should not be uploaded.  If you set Picture to Blank() patching there will be no issue.

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 602

#2
WarrenBelz Profile Picture

WarrenBelz 473 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 310

Last 30 days Overall leaderboard