+ Start a Discussion
AnzarCRMAnzarCRM 

APEX - CallCenter - Parse XML File

bob_buzzardbob_buzzard

As you have found out, the call center sobject doesn't hold all of the information from the file you import.  That file can be thought of as metadata, as it defines the items that need to be configured for the CTI adapter that will be used.  

 

If you need to get at this data programmatically, I think you'll need to upload it as a document or content file.  However, if you have multiple call centers defined I'm not sure how you would be able to marry up the document/content file to the call center - it may be as simple as the internal names matching I guess, but I've not done that before so can't say for sure.

bob_buzzardbob_buzzard

Apex has a DOM parse these days.  Check out this cookbook entry for more details:

 

http://developer.force.com/cookbook/recipe/parsing-xml-using-the-apex-dom-parser

 

AnzarCRMAnzarCRM

Very useful recipe, do you know to get the XML file to parse from a static resource or a content object or another way? I need to get the URL of my String (XML File) and call the DOM parser class to return the "CustomerId" Element.

 

Thanks,

bob_buzzardbob_buzzard

I don't think you can get at static resources from Apex.  If you upload as a document you can pull that back via a SOQL query.  The body will come back as a blob, but as its a text file you should be able to execute the Blob.toString() method and convert it to a string, which then allows you to drop straight in to the recipe parse method.