web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard