Dynamics 365 Business Central SaaS/Cloud: Can we change a user’s User Name and Full Name???

Dynamics 365 Business Central

Hi, Readers.
Yesterday, I saw a very interesting question in the Business Central Forum, how to add Full Name in the User card? More details: User Card (dynamics.com)

This looks like an external account, and since the Full Name is not added automatically, he wants to add it manually.
PS: The Full Name of the external account will also be automatically added to BC when syncing.

So, in this post, I would like to talk briefly about whether we can change a user’s User Name and Full Name in Dynamics 365 Business Central SaaS/Cloud.

As you might know, after you add users or change user information in the Microsoft 365 Admin Center, you can quickly import the user information to Business Central. 

  1. Sign in to Business Central using an administrator account.
  2. Choose the Lightbulb that opens the Tell Me feature. icon, enter Users, and then choose the related link.
  3. Choose Update Users from Microsoft 365.

The Update Users from Microsoft 365 guide doesn’t update users that are not assigned a license, such as someone who is Global Admin and Dynamics 365 Admin. Those users will update the next time they sign in to the environment.

More details: To add users or update user information and license assignments in Business Central

Let’s look at a simple example, I added a new test user.
First Name: First Name
Last Name: Last Name
Display Name: First Name Last Name
Username: FirstLast

Synchronize to Business Central.

User Name: FIRSTLAST = Username (Editable in BC)
Full Name: First Name Last Name = Display Name (Not editable in BC)

But there is a small problem. If we go back to the Microsoft 365 Admin Center, change the user’s information (Username and Display Name), and then synchronize again. These two pieces of information will not be synchronized in Business Central.
PS: My test Version: W1 24.3 (Platform 24.0.22214.0 + Application 24.3.21374.21517)

For example, click Dispaly name of the user.

Click Manage username.

Enter the new Username and click Save changes.

The username has been updated from ‎FirstLast@CRMbc158444.onmicrosoft.com‎ to ‎FirstLastNew@CRMbc158444.onmicrosoft.com‎. Notify them of this change so they aren’t blocked from signing in.

Then click Manage contact information

Enter the new Display Name and click Save changes.

Contact information updated.

You can see that both Display Name and Username have been updated.

But after syncing again, only the Authentication Email was updated, while the User Name and Full Name remained unchanged.

Update info from Andrew Wingate: If we want to modify the Full Name, we need to modify the First Name and Last Name. For example,

Full Name will automatically update.

For User Name, this is not a problem because it is editable and we can just modify the value.

You are renaming an existing user. This will also update all related records. Are you sure that you want to rename the user?

Very simple.

PS: If the same User Name exists in the system during synchronization, the system will automatically add a number after the user name.

For Full Name, this field is not editable. And the User (2000000120) table is a system table and cannot be edited through the Configuration Package.

You cannot use system table 2000000120 in the package.

In addition to the above method, we can also make a simple customization. Fortunately, this control is not written in the table.
table 2000000120 User:

page 9807 “User Card”:

So there are generally two ways to consider it.
1. Add an editable Full Name field directly on the User Card page.

You can also hide the original standard field. For testing purposes, I have shown two.

2. Modify the Full Name through an action. We can add it to the Users (9800, List) page.

This is a bit more complicated than the above process. You can create a simple card page or StandardDialog page to handle it. The following is an example of StandardDialog, I hope it can give you some tips.

StandardDialog page:

New action (Page extension):

Test:

Source code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)

pageextension 50203 UsersExt extends Users
{
    actions
    {
        addfirst(processing)
        {
            action(ChangeUserFullName)
            {
                ApplicationArea = All;
                Caption = 'Change User Full Name';
                Promoted = true;
                PromotedCategory = Process;
                Image = Open;
                trigger OnAction()
                var
                    ChangeFullNameDialog: Page "Change Full Name Dialog";
                    User: Record User;
                begin
                    User.Reset();
                    CurrPage.SetSelectionFilter(User);
                    if User.FindFirst() then begin
                        ChangeFullNameDialog.SetUserInfo(User."User Security ID", User."User Name", User."Full Name");
                        if ChangeFullNameDialog.RunModal() = Action::OK then
                            ChangeFullNameDialog.ChangeUserFullName();
                    end;
                end;
            }
        }
    }
}

page 50200 "Change Full Name Dialog"
{
    PageType = StandardDialog;
    Caption = 'Change Full Name Dialog';

    layout
    {
        area(content)
        {
            field(UserSecurityID; UserSecurityID)
            {
                ApplicationArea = All;
                Caption = 'User Security ID';
                Editable = false;
            }
            field(UserName; UserName)
            {
                ApplicationArea = All;
                Caption = 'User Name';
                Editable = false;
            }
            field(OldFullName; OldFullName)
            {
                ApplicationArea = All;
                Caption = 'Old Full Name';
                Editable = false;
            }
            field(NewFullName; NewFullName)
            {
                ApplicationArea = All;
                Caption = 'New Full Name';
            }
        }
    }

    var
        UserSecurityID: Guid;
        UserName: Code[50];
        OldFullName: Text[80];
        NewFullName: Text[80];

    procedure SetUserInfo(NewUserSecurityID: Guid; NewUserName: Code[50]; NewFullName: Text[80])
    begin
        UserSecurityID := NewUserSecurityID;
        UserName := NewUserName;
        OldFullName := NewFullName;
    end;

    procedure ChangeUserFullName()
    var
        User: Record User;
    begin
        if User.Get(UserSecurityID) then begin
            User."Full Name" := NewFullName;
            User.Modify(true);
        end;
    end;
}

Very simple, give it a try!!!😁

PS:
1. Dynamics 365 Business Central: Show the user’s display name on the top navigation bar when user is signed in

2. Dynamics 365 Business Central: How to display User Name from SystemCreatedBy/SystemModifiedBy field on the page (Translate a user security ID GUID to the corresponding user name)

3. Dynamics 365 Business Central: How to update/sync only one user from Microsoft 365

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL