You need to sign in to do that
Don't have an account?

Upsert Operation for XMl string
Hi, I am performing a Apex callout and am retreving data as a xml string. Now i would want to have my data used for Upsert Operation on Files__c Object.Below is how my xml
<APFilesData>
<APFiles>
<ApplicationId>a0B40000000vBJrEAM</ApplicationId>
<APID>0034000000SiXLtAAN</APID> <Photo1>//Bait/Applications/APApplications/AP0802720.Song/Photos/Photo1.jpg</Photo1>
<Photo2>//Bait/Applications/APApplications/AP0802720.Song/Photos/Photo2.jpg</Photo2>
<External_ID_Photo1>null</External_ID_Photo1>
<External_ID_Photo2>null</External_ID_Photo2>
<InactivePhoto1_Dt>11/10/2011 </InactivePhoto1_Dt>
<InactivePhoto2_Dt></InactivePhoto2_Dt>
</APFiles>
</APFilesData>
Below is how am retriving values
System.debug('BharathXML:' +XmlString);
GAPOrg.AjaxSoap Servicestub = new GAPOrg.AjaxSoap();
ServiceResult = Servicestub.GAPAPFilesGlobalRun(XmlString);
System.debug('XmlResult:' +ServiceResult);
Files__c upsertfiles = new Files__c();
Dom.Document docx = new Dom.Document();
docx.load(ServiceResult);
Dom.Xmlnode xroot = docx.getRootElement();
Dom.Xmlnode [] xrec = xroot.getChildElements();
And the values that need to upserted for FIles__c are
For each photo file, create one row to be inserted into Files__c in SFDC. Need the following columns:
Contact id (from AP_Application__c.Au_Pair__c)
Application Id (from AP_Application__c.Id)
Path (AP_Application__c.Photo1__c)
External Id (AP_Application__c. ExernalIdPhoto1)
Inactive Dt (new column, will map to Files__c.Inactive_Dt__c)
Files__c.Inactive_Dt__c
UPSERT Files
Use External Id to match Files__c. ExternalId
Files__c. AP_Application__c = Application id
Files__c.Contact__c = Contact id
Files__c.Path__c = Path