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
BasilBasil 

Insert case with existing contact

Trying to insert a case via API and have it linked to the existing contact, any ideas how to do?

According to SFDC Support, I need to use the contact_email field in order to link them together, however I cannot find the field name. Anyone knows? Furthermore since contact_email is another table, how do I make sure that I do not create a new blank record with only an email address if the matching email does not exist.

Would appreciate any help on this issue

Thanks

DevAngelDevAngel

Hi Basil,

Inserting a case should be a simple operation.  Create a new case object (assuming enterprise wsdl).  Set all the relevant case information on the object.  Obtain the id of the contact you want to link the case to.  Set the ContactId on the case to the id of the contact you want to link to.  Create the case using the create method.

Not sure who you talked to about contact_email, but the only fields that implicitly (ie at the server) participate in primaryKey/foreignKey relationships are fields that are type ID.

Cheers

BasilBasil

done, thanks a lot

I searched for the existing contact first and got his ID, then I set it to case's contactId

Contact name, Account name and contact email were filled correctly