How to process List of records in xml formate in Salesforce Apex

 Dom.Document doc= new Dom.Document(); // created Document object

doc.load(xml); //xml is xml fromated string 

Dom.XmlNode root= doc.getRootElement();

for(Dom.XmlNode orderNode : root.getChildElement()){ 

//we are loading list of records on by one in for loop // asume we are loading list of orders.

  Order orderRec= new Order();

  For(Dom.XmlNode fieldNode : orderNode.getChildElement())    {

//here we are getting each and  field is all object

 String field1Name= fieldNode.getName();

 String field1Value= fieldNode.getText();

 if(field1Name == order id && field1Value == "send"){

  //create updated account

}

Comments

Popular posts from this blog

How to get sessionid and salesforce org base url in salesforce

salesforce - sf - sfdx - cli - commands

Multi currency in Salesforce - Revenue Cloud Advance - Revenue Lifecycle Management