SBX - Search With Button

SBX - Forum Post Title

how to restrict enum lookup values in dialog? D365FO

Dynamics 365 for Finance and Operations Forum

junior AX asked a question on 13 Jun 2019 4:03 AM
My Badges

Question Status

Suggested Answer

Hi,

i made an enum called (enumx) with 4 values and i used it in many places. Now i created dialog by code where i added a field with this type but i don't want it to show all the 4 values, i only want to show two values. How can i do that? ( i don't want to create a new enum).

This is what i did:

enumx update;
DialogField fldUpdate;

private void dialogCreateControls(Dialog _dialog)
{

        fldUpdate= _dialog.addFieldValue(extendedTypeStr(enumx ), Update);

}

should i use this:?

fldUpdate.registerOverrideMethod(
methodStr(FormIntControl, lookup),
methodStr(class, fldUpdate_lookup),
this
);

Reply
Suggested Answer

Here is a blog post https://axspecialist.wordpress.com/2015/05/18/ax2012-show-only-some-value-of-enum-for-combobox-in-dialog/ it talks about 2012 but it should work just fine in current version as well. 

Reply
Blue Wang responded on 13 Jun 2019 10:14 PM
My Badges
Suggested Answer

Hi Junior,

There's an early blog here.

https://sivakumar007.wordpress.com/2013/11/14/restricting-enum-values-in-dialog/
The method it uses is controlMethodOverload(), but it is now discarded and replaced by controlMethodOverload().

So, you should try to use controlMethodOverload().

I hope it will help you.

Reply
Suggested Answer

Here is a blog post https://axspecialist.wordpress.com/2015/05/18/ax2012-show-only-some-value-of-enum-for-combobox-in-dialog/ it talks about 2012 but it should work just fine in current version as well. 

Reply
Blue Wang responded on 13 Jun 2019 10:14 PM
My Badges
Suggested Answer

Hi Junior,

There's an early blog here.

https://sivakumar007.wordpress.com/2013/11/14/restricting-enum-values-in-dialog/
The method it uses is controlMethodOverload(), but it is now discarded and replaced by controlMethodOverload().

So, you should try to use controlMethodOverload().

I hope it will help you.

Reply

SBX - Two Col Forum

SBX - Migrated JS