fbpx
  • Another way of doing consulting.

Start » Emiral » IAMCP Spain – Microsoft Partner Association and Emiral: Promoting Digital Transformation in Spain

Dynamics 365: Add a value to an enumeration

Adding a value to an enumerated type requires creating an extension, as is the case for any modification to the dynamix 365 standard for finance and operations.

The procedure

In the application explorer we can locate the enumeration that we want to extend. For this example we will use NumberSeqModule. When the enumeration is displayed, the elements it contains are shown, as can be seen in the following image.

In order to extend an enumeration it must have the property IsExtensible with value true. In the following image we can see that our example is extensible.

As our example can be extended, we click on the name with the right mouse button and select Create extension. That will create the extension in the project that we have open at that moment.

In the solution explorer we will then have the extension created. By default it has the name of the extended object followed by ".extension1» (or the corresponding number to avoid name collisions), which we can naturally rename.

The design view of the enumeration is opened by double-clicking on the extension name in the solution explorer. And so we can add the values we want. The following image shows the design view.

But what are all those values? In the first image of this entry there were not so many values. When we query or even when we open the design view of an enumeration, only the base values appear, but doing the same from the extension shows all the values of all the extensions (and the model in which they are located) that the enumeration has .

With the right button of the mouse on the name of the enumerated one we can create new values and assign the values that we want as the name, the label or the configuration key.

The details to consider

In the procedure we have seen that the steps to create a new value in an enumeration are simple and that although not all the existing values are seen at the beginning, at the moment of setting a name to the new value we will have at our disposal all the elements that exist in the extensions of the enumeration in the application so that we can choose a unique name that is useful to us for our value.

In previous versions, the numeric values of enumerations were deterministic, so instead of comparing against the names, we might be tempted to compare against the numeric value. Giving in to temptation complicates maintaining our mods and migrating between environments. As with other changes introduced in Dynamics 365, now they force us to work with a cleaner methodology. The base numeric values remain deterministic (but are chosen by Microsoft and might change in any future release). The numerical values of the extensions are determined at run time, so that each time we work with the enumeration, the values can be assigned to different numbers.

 

[vc_column_text align=»center»]

Are you ready for your company to reach a new level of success?

[/vc_column_text][vc_empty_space height=»15px»][mk_button dimension=»savvy» corner_style=»full_rounded» size=»medium» letter_spacing=»3″ url=»/contacto/» outline_skin=»custom» outline_active_color=»#000000″ outline_active_text_color=»#000000″ outline_hover_bg_color=»rgb(14, 102, 170)» outline_bg_color=»#555555″ outline_hover_color=»#ffffff» align=»center»]CONTACTA CON NOSOTROS[/mk_button]

Latest related posts

¿Miedo a cambiar de ERP?

Cambiar de ERP: Principales Miedos y Cómo Te Acompañamos para Superarlos Cambiar de ERP (sistema de planificación de recursos empresariales)