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 / Difficulty with a Clea...
Power Apps
Answered

Difficulty with a ClearCollect from a multi-select person column

(0) ShareShare
ReportReport
Posted on by 716 Moderator
I'm trying to build a Collection of the People that exist in a multi-select person column.
 
The ClearCollect is within the OnSelect of a Dropdown because the choice in the Director dropdown dictates what shows in the Manager dropdown.
This all worked beautifully with the AD structure but I was told today that there are manual overrides.
So I have an SP list that we're going to manually adjust over time but this logic only applies to some Directors.
I provide that as context to explain the nested IFs.
 
My problem is with the ClearCollect trying to build the collection from the LookUp. I've commented out the block with the problem and included it here. I think my problem is the LookUp inside the Commented block but I don't understand why.
That very same lookup is used earlier and works when this problem block is commented out.
 
If(
    Self.Selected.Email = DefaultCurrentDirector.Email,
    false,
    If(
        IsEmpty(
            LookUp(
                'Account Move - Hierarchy',
                Director.Email = DefaultCurrentDirector.Email
            ).Directs
        ),
        ClearCollect(
            CurrentDirectorSubCollection,
            ForAll(
                Filter(
                    Office365Users.DirectReportsV2(Self.Selected.Email).value,
                    accountEnabled = true,
                    "SALES MANAGER" in Text(jobTitle)
                ),
                If(
                    CountRows(Office365Users.DirectReportsV2(mail).value) > 0,
                    {
                        Claims: "i:0#.f|membership|" & mail,
                        Department: "",
                        DisplayName: displayName,
                        Email: mail,
                        JobTitle: jobTitle,
                        Picture: ""
                    }
                )
            )
        );
        UpdateContext({ResetCurrentManager: true});
        Set(
            DefaultCurrentManager,
            Blank()
        );
        UpdateContext({ResetCurrentManager: false});
        UpdateContext({ResetCurrentPrime: true});
        Set(
            DefaultCurrentPrime,
            Blank()
        );
        UpdateContext({ResetCurrentPrime: false})/*,
        ClearCollect(
            CurrentDirectorSubCollection,
            ForAll(
                LookUp(
                'Account Move - Hierarchy',
                Director.Email = DefaultCurrentDirector.Email
            ).Directs,
                    {
                        Claims: "i:0#.f|membership|" & mail,
                        Department: "",
                        DisplayName: displayName,
                        Email: mail,
                        JobTitle: jobTitle,
                        Picture: ""
                    }
            )
        )
        ;
        UpdateContext({ResetCurrentManager: true});
        Set(
            DefaultCurrentManager,
            Blank()
        );
        UpdateContext({ResetCurrentManager: false});
        UpdateContext({ResetCurrentPrime: true});
        Set(
            DefaultCurrentPrime,
            Blank()
        );
        UpdateContext({ResetCurrentPrime: false})*/
    )
);
Categories:
  • Verified answer
    DCHammer Profile Picture
    716 Moderator on at
    No one wanted to even take a shot at this. lol.
     
    I figured it out. The problem was this ClearCollect:
    ClearCollect(
                CurrentDirectorSubCollection,
                ForAll(
                    LookUp(
                    'Account Move - Hierarchy',
                    Director.Email = DefaultCurrentDirector.Email
                ).Directs,
                        {
                            Claims: "i:0#.f|membership|" & mail,
                            Department: "",
                            DisplayName: displayName,
                            Email: mail,
                            JobTitle: jobTitle,
                            Picture: ""
                        }
                )
            )
    That LookUp doesn't work because it only returns a single record from the Directs column.
    The solution is/was:
    ClearCollect(
                CurrentDirectorSubCollection,
                Table(
                    LookUp(
                        'Account Move - Hierarchy',
                        Director.Email = DefaultCurrentDirector.Email
                    ).Directs
                )
            );
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard