X++ gists for D365FO

A collection of X++ gists for those occasions when the help pages don’t cut to the chase!


It is important to following the naming guidelines when extending an existing object to ensure uniqueness across the Application Object Tree over time.

Table extensions

Additional methods are added to an existing table by creating a new class with an attribute declaring that it extends the existing table:

Class extensions

Additional behaviours are added to existing class methods by creating a new class with an attribute declaring that it extends the existing class:


Use multicast delegates to create extension points for other developers to subscribe to.

Remember that the order in which the handlers receive the invocation isn’t predictable.

Event Handlers

Take care not to add event handlers to a class that is already extending a table as the compiler will incorrectly add these methods to the Common object.

Delegate events

Subscribing to a multicast delegate:

Form events

Handling a form event:

Form data-source events

Handling a form data-source event:

Form control events

Handling a form control event:

Table events

Handling a table event:


Iterating enums

Regardless of the language, you should only ever reference an enum by its elements (and not it’s intrinsic value).  Historically, X++ developers have sometimes referred to the enumeration’s intrinsic values.  This is no longer supported in D365FO as these values are determined at runtime.

Using enums in a switch

We can also use the elements from an enum in a switch statement:

Working with XML

Iterating a list of XML nodes

More gists to follow…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: