Hi all,
So I've just started delving into Named Formulas, and love the performance increases, but I seem to have hit a block with the delegation warnings that come about.
These formulas send back delegation warnings when used elsewhere, which I'm aware is currently a bug:
//User Variables
currentUserProfile = Office365Users.MyProfile();
//User details variables
currentUserID = Left(currentUserProfile.UserPrincipalName,8);
currentUserName = currentUserProfile.DisplayName;
currentUserEmail = currentUserProfile.UserPrincipalName;
spendCategories =
Filter('Non-Pay Spend Categories', Number <> 0);
Reading around, it seems I can use With() to get around this, but this is new to me as well and it completely boggles my brain. I have tried this with the user variables, but no dice:
//User details variables
currentUserID = With({currentUserProfile: Office365Users.MyProfile()}, Left(currentUserProfile.UserPrincipalName,8));
currentUserName = With({currentUserProfile: Office365Users.MyProfile()}, currentUserProfile.DisplayName);
currentUserEmail = With({currentUserProfile: Office365Users.MyProfile()}, currentUserProfile.UserPrincipalName);
What am I doing wrong here?
Thanks for clarifying that. It appeared as if it would stop the delegation warning when declaring the named formula, but I must have read it wrong. I may just leave it for now until it is fixed.
I'm not sure what you've been reading, but I suspect that the With() statement is supposed to be included where you are accessing the Named Formula, not where you are defining the Named Formula. The With() forces the evaluation of the formula and then you use the value later on. Something like
With({_currentUserID: currentUserID},
Filter('SharePointList', 'UPN' = _currentUserID)
)
WarrenBelz
146,635
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional