cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Power Participant
Power Participant

ClearCollect not getting DisplayName

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: ClearCollect not getting DisplayName

@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."

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: ClearCollect not getting DisplayName

@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."

Highlighted
Power Participant
Power Participant

Re: ClearCollect not getting DisplayName

@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.

Highlighted
Super User
Super User

Re: ClearCollect not getting DisplayName

@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."

View solution in original post

Highlighted
Power Participant
Power Participant

Re: ClearCollect not getting DisplayName

@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?

Highlighted
Super User
Super User

Re: ClearCollect not getting DisplayName

@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.

 

 

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,199)