Business Central 2022 wave 2 (BC21) new features: Auto-save as you work -> Trigger timing of OnModify (Table) Trigger/OnModifyRecord (Page) Trigger has changed

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2022 wave 2 (BC21) is generally available last week. More details: Generally available: Dynamics 365 Business Central 2022 wave 2 (BC21)

I will continue to test and share some new features that I hope will be helpful.

Auto-save as you work:

Business value:

Since Business Central has no Save button, business users need full confidence that the data they enter or modify is saved automatically as they work. Similarly, developers need more accurate indication of data persistence when testing or debugging their code.

https://learn.microsoft.com/en-us/dynamics365-release-plan/2022wave2/smb/dynamics365-business-central/auto-save-as-work

As you might know, the autosave indicator in Business Central is shown on the right side of the card on screen and changes values when the computer communicates with the server and saves the data. The indicator can display Saving or Saved depending on current state. In case a data validation error appears, it would also display Not saved. For example,

But until BC20.5, we need to close the page for the data to actually be saved.

With this wave, Business Central immediately saves changes to individual fields as soon as you tab away from the field or set focus to another element on the page, instead of only saving when the page is closed. Changes are saved to the database without any noticeable impact to performance.

Here is a simple example provided by Microsoft on Business Central Launch Event (2022 release wave 2).

When user A block the item in item card, even if the page is not closed, user B will immediately prompt an error when using the item.

More details:

This is a very good improvement, but brings a problem. The trigger timing of OnModify (Table) Trigger and OnModifyRecord (Page) Trigger has changed.
OnModify (Table) Trigger: Runs when a user modifies an existing record in a table.
OnModifyRecord (Page) Trigger: Runs before a record is modified in the table.

Let’s look at a simple test.
Displays the following message when a user modifies an existing record in the Customer table.

Test Video: BC20.5 -> BC21.0
In BC21, the OnModify (Table) Trigger is executed every time as a field is modified.

So it is recommended that you check the content of your previous customizations again to avoid any impact on your customers.

PS: OnModifyRecord (Page) Trigger is the same.

Previously, this behavior was enabled exclusively for select UI experiences such as the Outlook add-in. Starting with 2022 release wave 2, this behavior applies to all Business Central clients including the desktop Web client, tablet client, phone client, Outlook add-in, Teams app, and embedding the client in any other applications.

The save indicator more accurately reflects the state of data on the page, even when working across multiple tabs or browser windows.

Administrators of Business Central on-premises can use the web server setting SaveValueToDatabasePromptly to turn off this capability (the setting is enabled by default).

navsettings.json file in C:\inetpub\wwwroot\BC210

“//SaveValueToDatabasePromptly”:  “Specifies whether all clients use promptly saving of edited fields to the database.”

Learn more:

Update 2022.10.15: Microsoft decided to add a feature switch in the November update (v21.1) after internal discussions. Thanks Blazej.😁

Below is the information that is allowed to be shared:

We have listened to your concerns and made a decision to give admins control to toggle the change on or off, so that we can strike a better balance between improving the consistent data saving experience and give our community time to adjust to the change. We will reintroduce this in the November update (v21.1), but now under a switch in Feature Management, making it optional until version 23. It will be set to ON by default for new environments in v21, and OFF for environments upgraded from v20 – similar to other changes listed in the Feature Management page.

Now on the change itself, we would like to demystify this a bit and will soon publish additional documentation changes and guidance – even explaining what has been changed and why. But for now, in essence please note that:

  • This change is intended to improve the data saving experience based on issues that our customers and partners have reported, including strengthening various multi-window and concurrent user scenarios, consistency across clients, and a more accurate save indicator that gives learning users the confidence that Business Central frequently saves their changes. It also gives an accurate signal for developers debugging data commit changes to the database.
  • We appreciate that some of the concerns arise from specific and sporadic code patterns applied to the OnModify trigger, such as contacting external services, displaying dialogs, updating empty fields, or performing heavy processing. We will be documenting best practices to help you apply code to the preferred triggers, so that you can achieve the same outcome in harmony with this change and the benefits it is intended to bring.
  • This improvement doesn’t change anything in the logic in the web client or cause compile errors. Granted, you will see the save operation happening more often now in the desktop web client or on mobile, but the general pattern is not new.
  • Because Business Central never had any “Save” button, the pattern of autosaving data has existed from the beginning. Forms were always saved as soon as possible and, in many cases, while being edited (for instance, when users navigated from sales header to lines, moved across lines, initiated an action, popped out a window,, etc.)
  • This improvement also has no impact on anything not related to web client user interactions. Background sessions, web services, or AL code remains unaffected. It is only reinforcing a user interaction pattern that already existed, for instance, in the Outlook client or popped-out pages.
  • We hope that introducing a feature switch will give you the ability to experience this improvement, test your code or solutions, and prepare for the change on your own terms.
  • As always, we welcome further feedback and suggestions here on Yammer to continue improving Business Central.

Update 2022.10.25: The feature switch for Auto-save with every field change has been added.
Test Version: W1 21.0 (Platform 21.0.46384.48092 + Application 21.0.46256.46853)

Info from Blazej|MS Yammer:

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL