SBX - Search With Button

SBX - Forum Post Title

Value of Extended Base enum is zero

Dynamics 365 for Finance and Operations Forum

Lukas Kujawa asked a question on 13 Aug 2018 2:22 AM

Question Status

Suggested Answer

Hello,

I have created extension of base enum EcoResCategoryNamedHierarchyRole, then I create new enum value. After DB synchronization this new value has integer value still zero. This issue is in UAT environment.

.   

Reply
Martin Dráb responded on 13 Aug 2018 2:27 AM

Where do you look for the value? Elements of extensible enums don't have Value property.

Reply
Lukas Kujawa responded on 13 Aug 2018 2:45 AM

I have created runnable job, which enumerates all values and names.

Reply
Martin Dráb responded on 13 Aug 2018 3:26 AM

Can you first check the values in EnumValueTable (using SSMS)? Then we can discuss your code, if it shows something else (and you share your code with us).

Reply
Ada Ding responded on 13 Aug 2018 3:50 AM
My Badges
Suggested Answer

Hi Lukas,

When enum values of extensible enums are synchronized, the integer values of the baseline enum are deterministic, whereas the integer values of the extension enum values are non-deterministic. The values are generated during synchronization. Therefore, you can't have logic that depends on the integer value of the enum values.

Please refer: docs.microsoft.com/.../add-enum-value

Reply
Lukas Kujawa responded on 13 Aug 2018 4:19 AM

In this table is integer value of my enum value zero, too. I do not use enums as integar in my code. This is my code: EcoResCategoryHierarchyRole::getHierarchiesByRole(EcoResCategoryNamedHierarchyRole::CommodityGroupHierarchy).CategoryHierarchy, method getHierarchiesByRole returns null common, because in the beginning of this is method is verification if variable is set.

Reply
Martin Dráb responded on 13 Aug 2018 4:58 AM
Suggested Answer

Okay, I see your point now. In my opinion, this is a bug in getHierarchiesByRole(), because 0 is a valid value of the enum.

You could meddle with the ID in UAT, but it would fix the problem in production. I think you need to get the bug fixed.

Reply
Lukas Kujawa responded on 13 Aug 2018 6:01 AM

Thank you, I have created Issue on LCS

Reply
Ada Ding responded on 13 Aug 2018 3:50 AM
My Badges
Suggested Answer

Hi Lukas,

When enum values of extensible enums are synchronized, the integer values of the baseline enum are deterministic, whereas the integer values of the extension enum values are non-deterministic. The values are generated during synchronization. Therefore, you can't have logic that depends on the integer value of the enum values.

Please refer: docs.microsoft.com/.../add-enum-value

Reply
Martin Dráb responded on 13 Aug 2018 4:58 AM
Suggested Answer

Okay, I see your point now. In my opinion, this is a bug in getHierarchiesByRole(), because 0 is a valid value of the enum.

You could meddle with the ID in UAT, but it would fix the problem in production. I think you need to get the bug fixed.

Reply

SBX - Two Col Forum

SBX - Migrated JS