cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
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
mdevaney
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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,389)