web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

ENUMs lookup.

(0) ShareShare
ReportReport
Posted on by

Hello,

1. I would like to add a lookup that shows a list of all the enum types.

2. I would like to add a enum, but show not only the enum values (i.e if the enum has 'A', 'B', 'C' values, want for to show 'A', 'B', without the 'C' when doing lookup on that enum).

Thanks :)

*This post is locked for comments

  • Verified answer
    Luca Pellegrini Profile Picture
    on at

    Hi Eitan,

    have you tried to create a temp table and fill it with your enum values (filtering them if needed) on the lookup method of your form control?

    Hope this helps.

    BR,

    Luca Pellegrini

  • Community Member Profile Picture
    on at

    You didn't understand me well - sorry.

    1. All the list of enums is like you standing on menuitem object, and see the list of all enum, when standing on enumtypeParameter property.

    2. I don't want using temporary table - just using a sysdictclass or something similar.

    Thanks :)

  • Verified answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    For your question number 1 here is the solution:

    public void lookup()

    {

    Query sysModelElementQuery;

    QueryBuildDataSource sysModelElementDataSource;

    QueryBuildRange sysModelElementRange;

    // create lookup table for SysModelElements and use the Name field

    SysTableLookup lookupTable = SysTableLookup::newParameters(tableNum(SysModelElement), this);

    lookupTable.addLookupfield(fieldNum(SysModelElement, Name));

    lookupTable.setLabel("Base Enum Name");

     

    // create a query used to filtering only the Base enumerations.

    sysModelElementQuery = new Query();

    sysModelElementDataSource = sysModelElementQuery.addDataSource(tableNum(SysModelElement));

    sysModelElementRange = sysModelElementDataSource.addRange(fieldNum(SysModelElement, ElementType));

    sysModelElementRange.status(RangeStatus::Hidden);

    sysModelElementRange.value(SysQuery::value(enum2int(UtilElementType::Enum)));

    lookupTable.parmQuery(sysModelElementQuery);

    lookupTable.performFormLookup();

    super();

    }

     

     

     

  • Suggested answer
    Luca Pellegrini Profile Picture
    on at

    Hi Eitan,

    you will definitely use the Sysdictclass object, but you'll fill the temporary table in order to give the lookup field a datasource.

    Or

    You can double check how the form DMFTargetXMLToEntityMap and look for the stringEdit: TargetXMLToEntityMapGroup_EntityField (method lookup). It's using a lookup method on UtilElements.

    Hope this helps.

    BR,

    Luca Pellegrini

  • Suggested answer
    Ivan (Vanya) Kashperuk Profile Picture
    Microsoft Employee on at
  • Community Member Profile Picture
    on at

    Sohaib - Thank you.

    Is there any similar solution for extended datatype (only string based).

    Thanks :)

  • Verified answer
    Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Eitan Mizrahi,

    Can you please explain little more ?

    Additionally, you may have a look at following standard examples from AX AOT

    1. SRSReportDeploymentSettings (Table)
    2. SRSReportDeploymentSettings (Form)
  • AyediHoussine Profile Picture
    5 on at

    You can use the method

    ControlName_LineType.delete((enum2Str(ABCEnumType::C)));

    where ControlName_LineType is the Formcomboboxcontrol name where we find the Enum variable.

    learn.microsoft.com/.../dynamics.ax.application.formcomboboxcontrol

    learn.microsoft.com/.../dynamics.ax.application.formcomboboxcontrol.delete

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans