function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
judbyjudby 

How to create a Contact referencing an Account using REST (java)

Hi,

I’m trying to create a Contact with reference to an Account using REST/java.

First I lookup Account using an External ID (which works) then tries to create the Contact referencing the Account, which fails.

I send this JSON:

{"Email":"test@agillic.com","AccountId”:”0018E00000IQgzDQAT","FirstName":"Agillic","LastName":"Test"}

with POST to

https://cs87.salesforce.com/services/data/v36.0/sobjects/Contact/

and get HTTP 400:

[{"message":"No such column 'AccountId’ on sobject of type Contact","errorCode":"INVALID_FIELD"}]

What am I doing wrong?
@GM@GM
Hi,

I'm able to do but there was some problen in format

Thanks,
GM

User-added image
judbyjudby
Yes, sorry, the cut'n'paste between stuff seems to have messed up the JSON.

Strangely, if do the exact same in my sandbox, I get the error (INVALID_FIELD)

Anyone?
User-added image