• Aaron Bauman 15
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
In my new sandbox org, upsert on Contact.Email is working somehow, even though I did not expect it to.
I'm using Contact.Email just like a external id + unique key, even though it's not set that way, for upserts and read-by-external-id operations.

Maybe it's Nonprofit Starter Pack?
Another other add-on?
I stumbled across this completely by accident.
I didn't even know it was possible for apps or packages to intercept an upsert request in this way.
Does anyone know anything about this?
REST auth token and SOAP auth token looks identical to me, yet I can't seem to get my Apex Webservice (SOAP) to accept it.
I'm successfully auth'ed to REST Partner API, and I'm trying to use the access token in my SOAP SessionHeader.

Each SOAP call gives me the unhelpful "invalid session" error.
Any ideas?
In my new sandbox org, upsert on Contact.Email is working somehow, even though I did not expect it to.
I'm using Contact.Email just like a external id + unique key, even though it's not set that way, for upserts and read-by-external-id operations.

Maybe it's Nonprofit Starter Pack?
Another other add-on?
I stumbled across this completely by accident.
I didn't even know it was possible for apps or packages to intercept an upsert request in this way.
Does anyone know anything about this?
I am using the REST API PATCH call to update a Contact like so:

URL: salesforce/data/<version>/sobjects/Contact/<externalidentifier>/<value>
JSON: map of fields to values

In addition to settings some values, I'd like to set others to null. I tried to pass fieldsToNull = [string, string, string] in the JSON.

However this results in a response saying:
"No such column 'fieldsToNull' on sobject of type Contact."

I also tried appending ?fieldsToNull=<field> to the request URL, which than returned successfully, but had no affect in respect to settings the field to null.

All documentation I can find providing examples with fieldsToNull are for soap/wsdl and not rest.

(I originally posted this in Java Development, but I think the question is general to the API.)

 

I have found documentation on how to create an Account and Contact in one API call, yet when I try it I get an error.  There seems to be a contradiction in what the documentation states and what the API will accept.

 

The document reference is:

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_create.htm#MixedSaveSection

 

... and states:

 

You can create records for multiple object types, including custom objects, in one call with API version 20.0 and later. For example, you could create a contact and an account in one call. You can create records for up to 10 object types in one call. 

 

Java examples are shown where an Account and Contact are passed to the create call.

 

 

Yet when I try this I get:

 

Exception in thread "main"       ...

...

Caused by: com.sforce.soap.enterprise.InvalidSObjectFault: INVALID_TYPE: all sObjects in create or update must be of same type

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

      at java.lang.reflect.Constructor.newInstance(Unknown Source)

      at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:127)

      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)

      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)

      at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)

      at $Proxy46.create(Unknown Source)

      ... 1 more

 

I have checked the API version we are using and it is Salesforce.com Enterprise Web Services API Version 23.0

 

Here is the code snippet:

 

List<SObject> sobjects = new ArrayList<SObject>();
Contact contact = new Contact();
//... set stuff on the contact
Account account = new Account();
account.setAccountId__C(getJAXBElement("AccountId__C", Double.class, getId()));
//crete the account reference and add to the contact
Account accountReference = new Account();
accountReference.setAccountId__C(getJAXBElement("AccountId__C", Double.class, getId()));
contact.setAccount(getJAXBElement("Account", Account.class, accountReference));

sobjects.add(account);
sobjects.add(contact);
apiContext.getPort().create(sobjects);

 

Thanks for any assistance!

Robin

I have a .NET service I'm building to give me access to the data in Salesforce. I'm trying to get my update method(s) to work. Specifically, I need to know how to clear the value of a field in Salesforce. I presumed that since we're using JSON to pass the data back and forth that I can just set the field to null in the JSON string and Salesforce will clear the current value. That appears to not be the case, or I'm just plain dumb. For example if I post {"Invoice__c":"blah blah blah"} it works fine. But if I post {"Invoice__c":null,"Finish_Date__c":null,"Scheduled_Date_Time__c":"\/Date(1333526400000)\/","Walk_Date_Time__c":null} nothing happens. I don't even get an error message back. It simply doesn't work.

 

Am I doing something wrong (I obviously must be doing something wrong)? How do I correct this?

 

Thanks in advance for any help!

Hi all,

 

I have tried to find some sample code on developer.force.com for how to upload to Content via API, unsuccessfully unfortunately. I would basically like to automate the batch-upload of a set of files, creating a new item in Content for each file. 

Does anyone have a link with some sample code in Java that I could use to get started?

 

Kind regards,

Martin