You need to sign in to do that
Don't have an account?
Successful Creation?
I created a new contact with the code below. Got the successful response from the xml shown below. But, I logged into salesforce and do not see the contact I created. Is something wrong with the code? does it take a while for new candidates to appear?
Thanks.
client.create! do |s|
s.namespace = 'urn:enterprise.soap.sforce.com'
s.namespaces["xmlns:urn1"] = 'urn:sobject.enterprise.soap.sforce.com'
s.namespaces["xmlns:xsi"] = 'http://www.w3.org/2001/XMLSchema-instance'
s.header = {'xsi:SessionHeader' => {'xsi:sessionId' => 'session id'}}
s.body = {"xsi:sObjects" => {"FirstName" => 'Test', "LastName" => 'Tester'}, :attributes! => {"xsi:sObjects" => {"xsi:type" => 'urn1:Contact'}}}.to_soap_xml
end
SOAP request: https://na2-api.salesforce.com/services/Soap/c/19.0/00D400000008UpO/0DF400000004Ge0
SOAPAction: create, Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:wsdl="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><xsi:SessionHeader><xsi:sessionId>session id</xsi:sessionId></xsi:SessionHeader></env:Header><env:Body><wsdl:create><xsi:sObjects xsi:type="urn1:Contact"><LastName>Tester</LastName><FirstName>Test</FirstName></xsi:sObjects></wsdl:create></env:Body></env:Envelope>
SOAP response (status 200):
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com"><soapenv:Body><createResponse><result><id>0034000000fdcHQAAY</id><success>true</success></result></createResponse></soapenv:Body></soapenv:Envelope>
=> #<Savon::Response:0xb678bad4 @http=#<Net::HTTPOK 200 OK readbody=true>, @soap_fault_message=nil, @hash={:create_response=>{:result=>{:success=>true, :id=>"0034000000fdcHQAAY"}}}>
No there's no delay. What exactly do you mean by you do not see the contact? If you're expecting to see it in the MRU list, records created via the API do not populate the MRU by default. If you search or use a list view you should see the record, or you can take the ID from the save result and go directly to that record.
I did a search all with the id from the response and it said it found nothing and I do not see it in the list view.
Ids are not indexed by search. just goto https://na2.salesforce.com/{theId}
Thank you very much. Next step is to create custom object and I am set.