Dynamics 365 Business Central: How to disable/switch off Teaching Tips for all (selected) users at the same time – Customization

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about a question that has been asked before, is there any way to disable Teaching Tips for all users at the same time.

The Teaching Tips (In-app contextual help) feature was first released in Business Central 2021 release wave 1 (BC18). More details: In-app contextual help improvements (AboutTitle Property and AboutText Property)

Customers want to get up and running with Dynamics 365 Business Central easier and faster. New visual aids help call out features and key business process fields and actions in Dynamics 365 Business Central, allowing the customer to self-learn and get educated on how to start using the product. These visual aids can be authored by partners who wish to bring them onto their app offerings.

https://learn.microsoft.com/en-us/dynamics365-release-plan/2021wave1/smb/dynamics365-business-central/in-app-contextual-help-improvements

In recent versions, Microsoft has added support for many pages, and you will see teaching tips when opening most pages in Business Central. So can we disable/switch off this feature if users are not interested in seeing these short introductions when they open the relevant pages.
Yes of course. There are two standard ways.

1. In the My Settings page, you can see a field Teaching Tips.

Teaching Tips: Specifies whether to display short messages that inform, remind, or teach you about important fields and actions when you open a page.

So, if you switch off Teaching tips, the short introductions will not be displayed when you open a page.

2. If you are an administrator, you can configure user settings in Business Central, similar to how individual users can manage their own preferences in the My Settings page.

You can open User Settings Card to switch off Teaching Tips.

More details: How to switch off teaching tips (In-app contextual help)

The first way requires users to log in to the system and operate by themselves. The second way requires the administrator to operate one by one……Okay, if the standard cannot be done, what should be done with customization?

First we can take a look at the processing of these two standards.

The first one, on the My Settings page:

page 9204 “User Settings”:

codeunit 9175 “User Settings Impl.” -> UpdateUserSettings (Access = Internal;)

As can be seen from the above process, this setting is saved in the table below. Every time we set it in My Settings, the data in the table below will be modified.

table 9222 “Application User Settings”

Please note that this table, like the posted table and entry table, requires additional permissions to access (Permissions Property).

For example,

Therefore, the data in the table cannot be accessed in the Configuration Package.

PS: User Security Id (SID) and User Id (Name)

Source code:

page 50102 "ZY Application User Settings"
{
    ApplicationArea = All;
    Caption = 'ZY Application User Settings';
    PageType = List;
    SourceTable = "Application User Settings";
    UsageCategory = Lists;
    Permissions = tabledata "Application User Settings" = rim;

    layout
    {
        area(content)
        {
            repeater(General)
            {
                field("User Security ID"; Rec."User Security ID")
                {
                    ToolTip = 'Specifies the value of the User Security ID field.';
                }
                field("Teaching Tips"; Rec."Teaching Tips")
                {
                    ToolTip = 'Specifies the value of the Teaching Tips field.';
                }
            }
        }
    }
}

So in short, we just need to modify the data in this table to complete the goal. But here’s another problem.

If you open the User Settings List (9206, List) page and compare the values in table 9222 “Application User Settings”, you will find that there are more records (users) in the User Settings List (9206, List). Why?

This is because some users have not logged in to the system and it has not been initialized.
PS: Check whether a user has logged in to the current environment (to any of the companies)

Let us look at the second standard processing, on the User Settings page:

page 9214 “User Personalization”:

codeunit 9175 “User Settings Impl.”: Here is one more procedure, GetAppSettings

Get the “User Security ID” in table 9222 “Application User Settings” and insert a new record if don’t get it, “Teaching Tips” is true by default.

Okay, so this also needs to be taken into mind when we modify all the user data.

Let me update the code.

Test video:

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

pageextension 50116 MyExtension extends "User Settings List"
{
    actions
    {
        addfirst(Processing)
        {
            action(DisableTeachingTips)
            {
                Caption = 'Disable Teaching Tips For All Users';
                Image = DisableBreakpoint;
                ApplicationArea = All;
                Promoted = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    ZYTeachingTips: Codeunit ZYTeachingTips;
                begin
                    ZYTeachingTips.DisableTeachingTips();
                end;
            }
            action(EnableTeachingTips)
            {
                Caption = 'Enable Teaching Tips For All Users';
                Image = EnableBreakpoint;
                ApplicationArea = All;
                Promoted = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    ZYTeachingTips: Codeunit ZYTeachingTips;
                begin
                    ZYTeachingTips.EnableTeachingTips();
                end;
            }
        }
    }
}

codeunit 50115 ZYTeachingTips
{
    Permissions = tabledata "Application User Settings" = rim;

    procedure DisableTeachingTips()
    var
        UserPersonalization: Record "User Personalization";
        ApplicationUserSettings: Record "Application User Settings";
        i: Integer;
    begin
        i := 0;
        UserPersonalization.Reset();
        if UserPersonalization.FindSet() then
            repeat
                if not ApplicationUserSettings.Get(UserPersonalization."User SID") then begin
                    ApplicationUserSettings.Init();
                    ApplicationUserSettings."User Security ID" := UserPersonalization."User SID";
                    ApplicationUserSettings."Teaching Tips" := false;
                    ApplicationUserSettings.Insert();
                    i += 1;
                end else begin
                    ApplicationUserSettings."Teaching Tips" := false;
                    ApplicationUserSettings.Modify();
                    i += 1;
                end;
            until UserPersonalization.Next() = 0;
        if i > 0 then
            Message('Teaching Tips disabled for %1 users.', i);
    end;

    procedure EnableTeachingTips()
    var
        UserPersonalization: Record "User Personalization";
        ApplicationUserSettings: Record "Application User Settings";
        i: Integer;
    begin
        i := 0;
        UserPersonalization.Reset();
        if UserPersonalization.FindSet() then
            repeat
                if not ApplicationUserSettings.Get(UserPersonalization."User SID") then begin
                    ApplicationUserSettings.Init();
                    ApplicationUserSettings."User Security ID" := UserPersonalization."User SID";
                    ApplicationUserSettings."Teaching Tips" := true;
                    ApplicationUserSettings.Insert();
                    i += 1;
                end else begin
                    ApplicationUserSettings."Teaching Tips" := true;
                    ApplicationUserSettings.Modify();
                    i += 1;
                end;
            until UserPersonalization.Next() = 0;
        if i > 0 then
            Message('Teaching Tips enabled for %1 users.', i);
    end;
}

Of course, you can also make it only effective for selected users.

Update the code again:

Test video:

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

pageextension 50116 MyExtension extends "User Settings List"
{
    actions
    {
        addfirst(Processing)
        {
            action(DisableTeachingTips)
            {
                Caption = 'Disable Teaching Tips For All Users';
                Image = DisableBreakpoint;
                ApplicationArea = All;
                Promoted = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    ZYTeachingTips: Codeunit ZYTeachingTips;
                    UserPersonalization: Record "User Personalization";
                begin
                    UserPersonalization.Reset();
                    CurrPage.SetSelectionFilter(UserPersonalization);
                    ZYTeachingTips.DisableTeachingTips(UserPersonalization);
                end;
            }
            action(EnableTeachingTips)
            {
                Caption = 'Enable Teaching Tips For All Users';
                Image = EnableBreakpoint;
                ApplicationArea = All;
                Promoted = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    ZYTeachingTips: Codeunit ZYTeachingTips;
                    UserPersonalization: Record "User Personalization";
                begin
                    UserPersonalization.Reset();
                    CurrPage.SetSelectionFilter(UserPersonalization);
                    ZYTeachingTips.EnableTeachingTips(UserPersonalization);
                end;
            }
        }
    }
}

codeunit 50115 ZYTeachingTips
{
    Permissions = tabledata "Application User Settings" = rim;

    procedure DisableTeachingTips(var UserPersonalization: Record "User Personalization")
    var
        ApplicationUserSettings: Record "Application User Settings";
        i: Integer;
    begin
        i := 0;
        if UserPersonalization.FindSet() then
            repeat
                if not ApplicationUserSettings.Get(UserPersonalization."User SID") then begin
                    ApplicationUserSettings.Init();
                    ApplicationUserSettings."User Security ID" := UserPersonalization."User SID";
                    ApplicationUserSettings."Teaching Tips" := false;
                    ApplicationUserSettings.Insert();
                    i += 1;
                end else begin
                    ApplicationUserSettings."Teaching Tips" := false;
                    ApplicationUserSettings.Modify();
                    i += 1;
                end;
            until UserPersonalization.Next() = 0;
        if i > 0 then
            Message('Teaching Tips disabled for %1 users.', i);
    end;

    procedure EnableTeachingTips(var UserPersonalization: Record "User Personalization")
    var
        ApplicationUserSettings: Record "Application User Settings";
        i: Integer;
    begin
        i := 0;
        if UserPersonalization.FindSet() then
            repeat
                if not ApplicationUserSettings.Get(UserPersonalization."User SID") then begin
                    ApplicationUserSettings.Init();
                    ApplicationUserSettings."User Security ID" := UserPersonalization."User SID";
                    ApplicationUserSettings."Teaching Tips" := true;
                    ApplicationUserSettings.Insert();
                    i += 1;
                end else begin
                    ApplicationUserSettings."Teaching Tips" := true;
                    ApplicationUserSettings.Modify();
                    i += 1;
                end;
            until UserPersonalization.Next() = 0;
        if i > 0 then
            Message('Teaching Tips enabled for %1 users.', i);
    end;
}

Great, I hope this post can give you some understanding of the background processing of Teaching Tips setup. Give it a try!!!😁

You can find more about Teaching tips and in-app tours for onboarding users in MS Learn (Docs).

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL