web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

DIXF - Dealing with Enums in a custom entity

(0) ShareShare
ReportReport
Posted on by

For a custom entity when trying to import it doesn't know how to handle any enums.  Some of these entities are filled with custom enums and such.  When I move it from staging to the target I get SQL errors about converting varchars to ints and then it fails.  Reading through the Microsoft documentation I was under the impression AX handles setting the enums correctly but that doesn't seem to be happening on custom entities.  

Is there a good example of how to change the Entity class to correctly set the enum values when moving from the staging to target?

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi Dougq,

    Can you provide the names of the fields in the normal table and the staging table? Please also provide information which extended data type is used for these fields in the staging table.

  • Community Member Profile Picture
    on at

    InventVendCust on the normal table, DMFInventVendCust on the staging.  

    InventVendCust is of enum InventVendCust, DMFInventVendCust is EDT DMFInventVendCust 

  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi Dougq,

    Have you looked into this thread community.dynamics.com/.../147653 this seems to me resolved by manual method. You can try this one

    Also on this link www.k3technical.com/data-migration-framework-create-a-custom-entity-for-migration at step # 5 can you have a look and try this one. I am not sure about this one but got this interesting to share with you.

  • Community Member Profile Picture
    on at

    I tried to fit that into this process but either I'm not doing it correctly or something else.  I still get this error:

    SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value 'Customer' to data type int.

    EDIT: Debugging it's not even hitting my methods even though I assigned that field to go through that function.  

  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi Dougq,

    For debugging in AX you need to disable the user option Execute business login in CIL. When you have changed the DMF helper class, you need to compile and generate incremental CIL. Then also regenerate the target mapping to have the latest links active.

  • Community Member Profile Picture
    on at

    I moved on from this import while I figure it out, and I had another already set up entity that I had to customize with a new field for import.  The new field was a enum.  So I had to create the DMF string field and it automatically handled that conversion.  Why is it handling that for me but with these custom entities it doesn't do the same?  I can't find what is different.

  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi Doug,

     

    You can try to set a breakpoint for the debugger on the class method DMFEntityBase::string2Enum(). This should do the conversion from the string to the enum value. The class DMFCheckField, method validateEnumStringValues is calling this static method.

  • Community Member Profile Picture
    on at

    In response to your previous questions Andre,

    the the enums only use 1 language, and they do have labels set up.  One of them is a sys level enum (InventVendCust).  Other is a custom enum with values in it that also have labels.  I will chicken that EMFEntityBase method

  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Probably for some reason this method is skipped. Then indeed a string might be copied to an integer (enum) field.

  • Community Member Profile Picture
    on at

    Yeah if I put in a debug point in the method it never gets hit and I get the same error on that InventVendCust enum (as well as others that are not noYes):

    SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value 'Customer' to data type int.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans