cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

@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 III
Super User III

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

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

@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

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

@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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (17,454)