0

Can we add attributes to xmlNode in Axapta 2012? If so, how do I do this?

Below is my XML. I need to add an Id attribute to the <Task> node.

<Task Id="Cs-2213">
    <Name>Cannot delete the picking lists (lines)</Name>
    <Version>6.2.1000.4051</Version>
    <Sprint>17.8</Sprint>
    <Project>Cs2213_Prd_DelPickIssue</Project>
    <Area>Production</Area>
    <Status>Closed</Status>
    <BugTrackId/>
</Task>
alexwlchan
  • 5,699
  • 7
  • 38
  • 49
user3226663
  • 137
  • 3
  • 17

1 Answers1

1

You can use the XmlElement.setAttribute method to add attributes to an XML node. So for example if xmlElement is the Task XML node, the code would be

xmlElement.setAttribute('Id', 'Cs-2213');

See also XmlElement.setAttribute Method [AX 2012] (MSDN documentation of the method) and Create XML and write to file in Dynamics AX (complete example and first Google result for "dynamics ax xml attributes")

FH-Inway
  • 4,432
  • 1
  • 20
  • 37