0

I have a field in the following format (Last Name, First Name) ie: Hamilton, Lewis.

But the User().FullName function will only return Lewis Hamilton.

How can I get these two equal to each other? Any workarounds?

1
  • Is this a custom field in SharePoint? How this field value is updated, manually or using script/flow? Ideally you should not match users based on display name because there can be multiple users with same display name in tenant. Do you have email address as one of the option here (maybe if you are using person or group column)? Commented Dec 8, 2022 at 2:42

1 Answer 1

0

One option could be to use a formula similar to this to re-write the "LastName, FirstName" field match the User().FullName field :

With(
    {
        NewValue: TrimEnds(
            Split(
                Label1.Text, //update with your label name
                ","
            )
        )
    },
    $"{Last(NewValue).Result} {First(NewValue).Result}"
)

However there could be some unexpected results if a name has a comma in it for some reason.

If that may be an issue, a more robust way may be to get the user details from Azure AD (or some other identity provider) and use the firstName and surname fields to do something similar to my formula above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.