Working with xmlcomment

Hello everybody,

I try to create a xml file with comments and it works fine. Now I try in batch job and the following error appears :

System.InvalidCastException: Unable to cast object of type ‘Dynamics.Ax.Application.XmlComment’ to type ‘Dynamics.Ax.Application.XmlElement’.

At the line :

xmlNode = xmlNodeWrite.appendChild(xmlDoc.createComment(xmlNodeRead.innerText()));

Is there a way to create xml comment in batch job?

Thanks in advance.

Hello Florent,

Did you get an answer to the above question of yours? I faced a similar issue while trying to writeoff customer balance through a batch. Similar to your case the code was working fine manually for me aswell but through a batch I was getting invalidcastexception for LedgerJournalEngine_Daily being type casted to LedgerJournalEngine. I worked around this issue by using an object of LedgerJournalEngine instead of LedgerJournalEngine_Daily. However I would like to know whether AX batch jobs support Type casting or not?.