Dynamics 365 Finance and Operations apps : SysExtensionSerializerMap – Your friend for adapting to normalization instead of extending tables when adding lot of fields

In every implementation of Dynamics 365 for Finance & Operation, there is need to add new fields in the core tables. With introduction of extension framework, Microsoft provided a clean way to add new fields without over layering the standard object hence making consumption of updates smooth.
However, Microsoft has introduced a best practice warning in the compiler when there are more than 10 fields added on a table via extension. The alternate recommended way is to create a new table and add a foreign key relation to standard table. One of the benefit of moving fields to separate tables is performance improvements. It makes sense because the performance cost associated with the retrieval of the custom fields should only be incurred when processes which needs these fields are executed.
This sounds good from database normalization perspective. But when you are working in a business application, then the expectation is that data in the custom table should be inserted, updated and deleted along with the core table.  In order to make developers life easy there are maps – SysExtensionSerializerMap and SysExtensionSerializerExtensionMap available out of the box.
These were available in previous versions of the product AX 2012.
If used smartly developers can save efforts and reduce complexity to write custom logic of CRUD operations on the new table and in fact provide more flexibility when we need to access the table buffer. Below are key steps we should use when creating a new table to store custom fields:

 Other best practices related to creation of tables like adding indexes, field groups, properties etc. still remain intact.


Below is how a table, for illustration, should look. In this example, I have created a table instead of adding fields via extension and have only added one field.

Mapping properties should look like : 
Below is how the relation properties should look like:
Define the index as alternate index and use it as replacement key on the table properties
Index properties: 
Table properties: 
Once this mapping is added then developers don’t have to worry about things like calling insert and update methods on the new table whenever a record is created or updated in core table. This is how it works:
SysExtensionSerializerMap has methods like postInsert(), postUpdate() and more as shown below.






postInsert() Inserts the packed extension table record after the base table record is inserted, it uses SysExtensionSerializerFormRunHelper class to perform the logic.
Most of the tables where insert method is overridden, call methods of these maps as shown below
A nicely modeled data structure will enable developers to focus on writing the business logic and leverage the platform capabilities. 
Thanks for reading the blog. I still love the old school tag line to end the blog – happy DAXing J

One Reply to “Dynamics 365 Finance and Operations apps : SysExtensionSerializerMap – Your friend for adapting to normalization instead of extending tables when adding lot of fields”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.
%d bloggers like this: