Create Salesforce Case object with nested relationships using REST API

I am attempting to create a new Case object using the REST API but need to find out how to format the JSON body to pass in nested SObjects.

It's not apparent in the Docs, and I can't seem to find any examples. Anyone have any pointers or have done this before?

The SF web UI uses a text lookup field to set the (related) Contact and Account, and I need to figure out how to either bypass the need for a lookup or embed the SObjects of the related records in the JSON.

[{"message":"The value provided for foreign key reference Contact is not a nested SObject","errorCode":"INVALID_FIELD"}]

Answers


Figured it out by simply setting the AccountId and ContactId attributes on the new Case object.


I also haven't seen any documentation about this, but if you look at the object metadata returned by the REST API for any standard object, it seems that the suffix 'Id' is appended to any field of type "reference". For example, Case has OwnerId, LastModifiedById, CreatedById, etc. This suffix is not present in the field names displayed in the browser interface. The WSDL for the SOAP API includes both the ID as a simple element of type "ID", as well as a complex child element for nesting the actual record.


Need Your Help

UIImage in UITableView displaying the other cell's image for a second

ios uitableview uiimageview

I am trying to load image asynchronously in a UIImage that resides in a table view cell. sometimes it shows the image from another cell for a second before it displays the correct one.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.