• Nick SFDC
  • NEWBIE
  • 0 Points
  • Member since 2018
  • Salesforce Developer | Adminstrator

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Is there any way to get the custom auto-number as response form a Bulk create contact soap request without making another API call for a SOQL query?

Eg: Sample Create Bulk Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId>${SessionID}</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
       <urn:sObjects xsi:type="urn1:Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
            <Salutation xsi:nil="false">Mr.</Salutation>
            <FirstName xsi:nil="false">David</FirstName>
            <LastName xsi:nil="false">McCall</LastName>
       </urn:sObjects>
        <urn:sObjects xsi:type="urn1:Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
            <Salutation xsi:nil="false">Ms.</Salutation>
            <FirstName xsi:nil="false">Laura</FirstName>
            <LastName xsi:nil="false">McCall</LastName>
       </urn:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>



Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <LimitInfoHeader>
         <limitInfo>
            <current>114</current>
            <limit>5000000</limit>
            <type>API REQUESTS</type>
         </limitInfo>
      </LimitInfoHeader>
   </soapenv:Header>
   <soapenv:Body>
      <createResponse>
         <result>
            <id>003c0000000000000V</id>
            <success>true</success>
         </result>
         <result>
            <id>003c0000000000000V</id>
            <success>true</success>
         </result>
      </createResponse>
   </soapenv:Body>
</soapenv:Envelope>
I know we can create custom Apex SOAP webservice to get the auto-number as response but, in that I am able to insert only one record per request.
I need to resolve it in SOAP call..
Apex SOAP webservice 
global class contactCreate {
  webservice static Return Post(String FirstName, String LastName) {
        List<Contact> contList = new List<Contact>();  
        Contact Cont = new Contact(
                                    FirstName     = FirstName, 
                                    LastName     = LastName
                                   );
        contList.add(Cont);               
        try{
              insert conL;
              List<Contact> con    = [SELECT Id, SFContactId__c
                                                      FROM Contact
                                                   WHERE Id IN:conL];
              return new Return('TRUE',' Created Successfully.', con);
            }catch (Exception e)  {
              return new Return('FALSE',e.getMessage(), NULL); } 
    }
}
Is there any way to get the custom auto-number as response form a Bulk create contact soap request without making another API call for a SOQL query?

Eg: Sample Create Bulk Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId>${SessionID}</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
       <urn:sObjects xsi:type="urn1:Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
            <Salutation xsi:nil="false">Mr.</Salutation>
            <FirstName xsi:nil="false">David</FirstName>
            <LastName xsi:nil="false">McCall</LastName>
       </urn:sObjects>
        <urn:sObjects xsi:type="urn1:Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
            <Salutation xsi:nil="false">Ms.</Salutation>
            <FirstName xsi:nil="false">Laura</FirstName>
            <LastName xsi:nil="false">McCall</LastName>
       </urn:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>



Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <LimitInfoHeader>
         <limitInfo>
            <current>114</current>
            <limit>5000000</limit>
            <type>API REQUESTS</type>
         </limitInfo>
      </LimitInfoHeader>
   </soapenv:Header>
   <soapenv:Body>
      <createResponse>
         <result>
            <id>003c0000000000000V</id>
            <success>true</success>
         </result>
         <result>
            <id>003c0000000000000V</id>
            <success>true</success>
         </result>
      </createResponse>
   </soapenv:Body>
</soapenv:Envelope>
I know we can create custom Apex SOAP webservice to get the auto-number as response but, in that I am able to insert only one record per request.
I need to resolve it in SOAP call..
Apex SOAP webservice 
global class contactCreate {
  webservice static Return Post(String FirstName, String LastName) {
        List<Contact> contList = new List<Contact>();  
        Contact Cont = new Contact(
                                    FirstName     = FirstName, 
                                    LastName     = LastName
                                   );
        contList.add(Cont);               
        try{
              insert conL;
              List<Contact> con    = [SELECT Id, SFContactId__c
                                                      FROM Contact
                                                   WHERE Id IN:conL];
              return new Return('TRUE',' Created Successfully.', con);
            }catch (Exception e)  {
              return new Return('FALSE',e.getMessage(), NULL); } 
    }
}
Hi,

So we will be using an API to connect Salesforce to a third party app and one of the fields shared is Address. In Salesforce, the address is already concatenated (it comes in through a separate web app as Address Line, Address Line 2, City and Postcode). However the third party we want to connect to requires the Address field to be split. Is there some apex or mechnanism that would split the fields? Or anything that needs to be written into the API connections to enable this?

Any help is much appreciated :)
Many Thanks,
Natasha