cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Level 8

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

JimmyWork
Level 8

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.

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

JimmyWork
Level 8

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?

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,386)