You need to sign in to do that
Don't have an account?
Nick SFDC
How to get custom auto number as response in Create SOAP API BULK request ?
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
Response:
I need to resolve it in SOAP call..
Apex SOAP webservice
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); } } }
Thank you for responding!
I have my return class someting like below.. and I'm able to get the auto-number as response but using the above soap webservice I'm able to insert only one record at a time..below is the xml I got after importing wsdl onto SoapUI. When I try to insert more than 1 record it's throwing an error "one operation at one request"... How to make above apex soap webservice to insert more than one record in one request and fetch autonumbers for all those records as response Response: