Automatically merge enums

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2

Each code upgrade checklist in Microsoft Dynamics AX 2012 R2 or R3 contains the optional Automatically merge enums task, which is run before the application is compiled. This task identifies enums (enumerated data types) that differ between versions, but that can be merged automatically. By merging enums before compiling, you can reduce the number of compile errors and the time that is required to resolve code conflicts.

How enum versions are merged

In the Automatically merge enums task, the upgrade framework checks for cases that meet the following conditions:

  • The customer has modified the enum in a higher layer, and that layer has fewer members than the lower SYS layer.

  • Microsoft modifies the enum in the SYS layer for Microsoft Dynamics AX 2012 R2 or R3.

  • The modifications do not conflict, that is, no two members share the same name or the same integer Enum Value property.

If these conditions are met, the upgrade framework merges the two objects. For example, an enum FOO has the following history:

  1. SYS ENUM FOO = A //Microsoft shipped enum FOO with value A in Microsoft Dynamics AX 2012 or Microsoft Dynamics AX 2012 Feature Pack.

  2. USR ENUM FOO = B //The customer added a value B to enum FOO in Microsoft Dynamics AX 2012 or Microsoft Dynamics AX 2012 Feature Pack.

  3. SYS ENUM FOO = A, C //Microsoft adds a value C to the enum in Microsoft Dynamics AX 2012 R2.

The following table illustrates this scenario.

Layer

Baseline value

Microsoft Dynamics AX 2012 R2 or R3 value

USR

A, B

SYS

A

A, C

The customized and default enums can be merged as follows. The merger copies the new Microsoft member C from SYS into the USR layer, since otherwise it would be masked by the higher layer.

Layer

Baseline value

Microsoft Dynamics AX 2012 R2 or R3 value

USR

A, B

A, B, C

SYS

A

A, C

Merging the enums

When you click Automatically merge enums, a progress indicator shows that merges are occurring. When the merge process is completed, an Infolog window opens. This window lists each enum that was successfully merged and conflicting enums that could not be merged. The unmerged enums require manual conflict resolution.

Important

Any change to an integer Enum Value property that is used in business data will require the creation of a data upgrade script to resolve the difference.