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)

Serialization in X++

(0) ShareShare
ReportReport
Posted on by

Hello,

In AX 2009, I've added a reference (PIESClass) to a .NET class (PIESFile) which has namespace PIES.  I'm now using this reference to build an XML document which I'd like to serialize to a file.  But I'm not finding the right way to do this.  I'm trying this kind of thing:

System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(PIESClass.PIES));
 Error: The table does not contain this field.

System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(PIESClass));
Error: Variable PIESClass has not been declared 

I've found quite a bit of info online about serializing, but nothing that tells me exactly what "typeof" is looking for.  Help, please?

Thanks!
Carolee 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Please follow following link for more details related to your scenarion

    technet.microsoft.com/.../aa856184.aspx

    this information explains how we have do XML serialization in Dynamics AX

    Please verify and let me know if this information helps you

  • Community Member Profile Picture
    on at

    Thank you, Nitesh, but I don't think is quite what I need. I'm not using the AIF but System.Xml.Serialization.XmlSerializer.

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Your code would work as C# (if you used a correct type name), but not in X++. typeOf() in X++ is something completely different than typeOf() in C# and it won't return System.Type required by XmlSerializer.

    If you have an instance of PIES.PIESFile, call its GetType() method. If you can't get an instance, get the type by System.Type::GetType().

  • Community Member Profile Picture
    on at

    YYYYYYEAH!  Thanks very much, Martin!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans