AX / D365FO – Avoid entering values that are not included in a lookup

I’m building a Form with a field with a lookup inside.

I don’t want the user to be able to enter values that are not within the range of values allowed by the lookup. How to do?
A solution could be to use the validate() method signaling an error in case of an incorrect value. But I don’t want to write code so a possible alternative could be to use the “Lookup only” property of the Form control.

The property can be activated from the field properties or via code:

Propery form :

Code X++ :

Leave a Reply

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

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

Facebook photo

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

Connecting to %s