Extending “Sales Line Type” enum in Business Central 16.0

azharsaeedkhanazharsaeedkhan Member Posts: 34
edited 2020-04-26 in NAV Three Tier
i am working on BC version 16.0, as in BC 16.0 option field is replaced with enum, as you can see here (gwyl8dagicht.png
) that i am extending a "Sales Line Type" enum and adding a new value to it. But when i inspect the "Sale Line" table it is showing that the field Type is option and not an enum (rk6hije0ptdd.png
). So the value i have added to enum is not displayed.

How can i extend "Sales Line Type"? am i doing something wrong?

Best Answer

  • azharsaeedkhanazharsaeedkhan Member Posts: 34
    Answer ✓
    @DenSter this should be reported to microsoft on github.
    but for now i have found a workaround, by going through the standard code i have found this
    hmdcwj824jmd.png
    the tooltip text i was looking at was not of the field Type but of the field FilteredTypeField, so this inspired me do the following changes in the pageextension
    hw23i4n8l0v7.png
    and boom, it worked out
    5yy45tyae32m.png

Answers

  • JuhlJuhl Member Posts: 724
    Respect number range as always.
    If per tenant use 50000 instead of 6.

    Think what happens if MS add a new value with number 6 😉
    Follow me on my blog juhl.blog
  • azharsaeedkhanazharsaeedkhan Member Posts: 34
    edited 2020-04-24
    @Juhl sorry about that i was supposed to share the other screenshot (Updated now).
    But it doesn't work like that, i have added multiple values in the range >=50000 but no success.
  • DenSterDenSter Member Posts: 8,304
    edited 2020-04-24
    That is supposed to work. The enum is extensible, and it looks like you are extending it correctly. I just tried in a new sandbox container and it is also not showing up for me. Maybe what is missing is the additional tablerelationship. You're adding a value to the enum, maybe BC is expecting an explicit tablerelationship for that value. See here for an example: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-extensible-enums

    If you can't make it work with an additional table relationship, I would submit an issue in GitHub
  • azharsaeedkhanazharsaeedkhan Member Posts: 34
    Hi @DenSter!
    i have already added additional table relationship
    629j6t0uo77g.png
  • azharsaeedkhanazharsaeedkhan Member Posts: 34
    Answer ✓
    @DenSter this should be reported to microsoft on github.
    but for now i have found a workaround, by going through the standard code i have found this
    hmdcwj824jmd.png
    the tooltip text i was looking at was not of the field Type but of the field FilteredTypeField, so this inspired me do the following changes in the pageextension
    hw23i4n8l0v7.png
    and boom, it worked out
    5yy45tyae32m.png
  • DenSterDenSter Member Posts: 8,304
    edited 2020-04-26
    Glad you were able to make that work, and thanks for posting your solution. I had also tried adding the tablerelationship and found that it didnt fix it for me either

    You can report the issue yourself here: https://github.com/microsoft/AL/issues
Sign In or Register to comment.