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})*/
)
);