6

Here is my situation:

I have created a custom object called "CSB" with fields:

  • source_xml__c => Text
  • IPN__c => text
  • Salesman => Lookupfield to "User"

In the "User" object there is a custom field

  • IPN__c => a text field with "external id" checked

What I want to do:

I want to be able to insert a new "CSB" using the built in REST services of SalesForce. This has succeeded by POSTing a JSON string containing al information needed to create a valid "CSB". BUT I had to use the "User's ID" (manually, because this is normally not known in my application) ==> I want to be able to insert a new "CSB" using the external ID "IPN__c" which I do know.

Does anybody have an idea on this one?

  • Did you check the documentation ? salesforce.com/us/developer/docs/api_rest/… – Samuel De Rycke May 3 '13 at 14:06
  • 1
    "Salesman"??? A bit gender specific! Seriously, I can see this being a problem for you one day... – metadaddy May 3 '13 at 20:44
  • Why would you say that? The field literally refers to a person who sells cars, so we call it "Salesman". My object "CSB" contains information about the car that was sold and who sold the car (this is the Salesman). So yes it is a little "gender specific" but it will always be correct... I don't see how else you would refer to a person who sells things? – Nielsm May 6 '13 at 12:27
4

Ok so the solution can be found in the documentation.

Apparently you can reference to the "User" object like this:

{
  "Source_XML__c": "[Some xml-string]",
  "Salesman__r" : {
       "IPN__c" : "db02236"
   },    
  "IPN__c": "db02236"
}

Source: SalesForce documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.