0

I am trying to create a Batch job. For that initially, i have created a class and added a method. Now I am attaching this class to the Action Menu item. and generated Incremented CIL. But when I open the menu item I am Getting the error. bellow is my code and relevant screen shots.

 [DataContractAttribute]
class BatchJobDemoClass
{
}

[DataContractAttribute]
public void xmlGeneration(Args _args)
{
XmlDocument doc;
XmlElement nodeXml;
XmlElement nodeTable;
XmlElement nodeAccount;
XmlElement nodeName;
CustTable custTable;
#define.filename(@'C:\\Users\user\Desktop\productsXML.xml')
;
doc = XmlDocument::newBlank();
nodeXml = doc.createElement('xml');

doc.appendChild(nodeXml);
//Determines the runtime
if (xSession::isCLRSession())
{
info('Running in a CLR session.');
}
else
{
info('Running in an interpreter session.');

//Determines the tier
if (isRunningOnServer())
{
info('Running on the AOS.');
}
else
{
info('Running on the Client.');
}
}

while select custTable
{
nodeTable = doc.createElement(tablestr(CustTable));
nodeTable.setAttribute(fieldstr(CustTable, RecId),int2str(custTable.RecId));
nodeXml.appendChild(nodeTable);
nodeAccount = doc.createElement(fieldstr(CustTable, AccountNum));
nodeAccount.appendChild(doc.createTextNode(custTable.AccountNum));
nodeTable.appendChild(nodeAccount);
nodeName = doc.createElement(fieldstr(CustTable,CustGroup));
nodeName.appendChild(doc.createTextNode(custTable.CustGroup));
nodeTable.appendChild(nodeName);
}
doc.save(#filename);
info(strFmt("File %1 created.", #filename));
}

Action Menu ItemProperties Of Menu Item Error While Opening It

Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
venkat pasumarti
  • 138
  • 1
  • 1
  • 12
  • Please check this simple tutorial http://www.artofcreation.be/2011/08/22/ax2012-sysoperation-part-1-data-contracts-and-service-operations/ – Aliaksandr Maksimau Mar 05 '18 at 12:08
  • Tutorial is good but i am trying to export data into the XML Files How can i do that? i have created the service class but got confused how to run the data contract class in service class. could you please help me with that. – venkat pasumarti Mar 05 '18 at 12:37
  • Did you change your code? Can you update the question with your new code? – Aliaksandr Maksimau Mar 05 '18 at 16:35
  • Please work through a SysOperation example like the one that Aliaksandr suggested. Your posted code shows that you seem to be confusing the data contract and the service class. – FH-Inway Mar 05 '18 at 17:14

0 Answers0