+ Start a Discussion
John GerhardJohn Gerhard 

Create Object From XML


Okay, I have played with Apex and built a few triggers/classes and they have worked perfectly I have also made them bulkified and I am getting pretty savvy there.

My next project is to receive an XML file from an external source, parse that xml file and create a custom object called Verification. Inside this object we have a few fields called phone number, status(picklist), and name(text field.) So I did the trail heads for API beginner and a few of the advanced one, the problem I am running into is that I can't find anything that teaches me how to recieve a file, process it, and create an object. Everything I can find is send out a request and then get the response from the request and blah blah... So I have no idea where to even start with this one. I am pretty sure I need to use the SOAP API, other then that I am not sure how to send the file to SalesForce, or how to process the file to match what SalesForce needs to create the record. I think if I can get some help for those first two parts I can easily knock it out from there.

I think optimally what I am looking for is a tutorial of how to recieve the XML file like what credentials do I need to give to the sender, how to see how the file looks coming in, and then how to parse it to make sense to SalesForce.

Thank you,
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi John,

The Salesforce objects can be updated via Metadata. The good news is the metadata for objects is an XML file, so depending on the contents of your file it would be feasible to use an XSLT to convert to the Salesforce XML definitions.
I suggest you please refer the below link.
 http://www.salesforce.com/us/developer/docs/api_meta/api_meta.pdf  (http://​ http://www.salesforce.com/us/developer/docs/api_meta/api_meta.pdf )

Hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Rahul Kumar
John GerhardJohn Gerhard
Thanks for the response Rahul, so I am trying to basically stumble my way through this task one step at a time. I guess the first step I need to figure out is how to send the xml into SalesForce from an external server and then how to process that file. The part I am struggling with is all the tutorials and documentation in places like Trailhead are sending a request from SalesForce to a server and then getting the response and reacting rather than just receiving a file from a server that I did not make a call out to.