I'm using ForceClient in Force.com Toolkit for .NET to save a custom object with a link to a Lead record.
private class Lead
{
public const string SObjectTypeName = "Lead";
public string Id { get; set; }
public string LastName { get; set; }
}
private class ResourceView
{
public const string SObjectTypeName = "ResourceView__c";
public string Id { get; set; }
public Lead Lead__c { get; set; }
public string Name { get; set; }
}
ResourceView rv = new ResourceView()
{
Name = "Important PDF",
Lead__c = lead
};
var resourceView = await client.CreateAsync(ResourceView.SObjectTypeName, rv);
Here is the field list configured in SF:
This call fails with:
Cannot deserialize instance of reference from START_OBJECT value { or request may be missing a required field at [line:1, column:2]
I also tried changing Lead__c to be a string and pass the lead.Id from Salesforce. This fails with:
Lead: id value of incorrect type: 0035800000AQqGfAAL
If I remove setting the Lead property, the object saves successfully.