Home > DynamicsAx Utilities > Insert the De-Serialized XML file values into Ax-Table

Insert the De-Serialized XML file values into Ax-Table

Further journeying from my previous article http://paruvella.spaces.live.com/blog/cns!F2EC589E221A4DB0!546.entry

In my previous article we have explored how we can read the XML string and field values.

In this article we will explore, how we can store those field values in to the table.

Assume that we have table,

Now generate Ax-BC class for the above table, if we already have Ax-BC for the same no issues, otherwise create the same from

AOT à Classes à AxGenerateAxBCClass

Run the above class by selecting our above table.

Make sure that class is free from compile errors.

After the Ax-BC class is created and made that compile free. Use the following job.

static void PSReadXMLFileAsStringAttr(Args _args)

    XmlTextReader       xmlTextReader ;
    str                 xmlString = ‘<ATGSubmitOrder xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/ATGSubmitOrder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">’
                                    +'<ATGAXSTGCustTable action="create" Id="PS">’

    str                 fieldName;
    SysDictClass        sysDictClass;
    str                 parmMethodName;
    AxATGAXSTGCustTable axCustTable;


    xmlTextReader = XmlTextReader::newXml(xmlString, true) ;

        switch (xmlTextReader.NodeType())
                case XmlNodeType::Element: // The node is an element.
                    fieldName = xmlTextReader.Name();
                    switch (fieldName)
                        case "ATGAXSTGCustTable":
                            sysDictClass = new SysDictClass(classnum(AxATGAXSTGCustTable));
                            axCustTable = sysDictClass.makeObject();
                case XmlNodeType::Text: //Display the text in each element.
                    parmMethodName = "parm" + fieldName;
                    sysDictClass.callObject(parmMethodName, axCustTable, xmlTextReader.Value());
                case XmlNodeType::EndElement: //Display the end of the element.
                    switch (xmlTextReader.Name())
                        case "ATGAXSTGCustTable":
                            sysDictClass.callObject("doSave", axCustTable);


Run the above job and see the result in table from the table browser.

Secret telling smile….Eye rolling smile

Categories: DynamicsAx Utilities
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: