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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error while adding DialogField of type 'str' to a dialog

(1) ShareShare
ReportReport
Posted on by 2,720

I had code for creating a dialog with dialog field of type 'str' in a custom class in AX2012. It worked fine in AX 2012, after upgrading the code to update3(AX 7) the same code gave an exception at DialogField's init method . No enum value in 'Types' matching 'str' is found.


The code used was dialogField1    = dialog.addField(identifierStr(str), "@AVA108");


As mentioned above it worked fine in AX 2012 so i have created a job using DialogField's init method from which this exception was thrown, it gave String as output in AX2012. 

Types           baseType;

identifierName  typeName;

typeName = identifierStr(str);

baseType = str2enum(baseType, typeName);

info(enum2Value(baseType));

I have resolved this by using an extended type instead of primitive type. But i would like to know why this exception has been thrown.

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    You don't use the addField() according to its contract. It expects a name of an EDT or an enum, not a primitive type. Use an EDT appropriate for the dialog field, such as addField(extendedTypeStr(ItemId), "@AVA108").

  • Basheer17 Profile Picture
    2,720 on at

    Hi Martin,

    Yes. I have used an EDT in current version. I just wanted to know if it excepts name of an EDT it should have thrown exception in AX 2012 as well.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans