Dear smart developers out there,
I encounter a problem when I want to create a contact belonging to an organization in Microsoft Dynamics CRM 2013 via web services
client = new OrganizationServiceClient("CustomBinding_IOrganizationService"); 
var newContactProperties = new Dictionary<string, object> { 
                { "lastname", "TestContact"}, 
                { "firstname", "A"},
                { "fullname", "A TestContact"}
        };
/* organizationType is a CRM.CRMWebServices.OptionSetValue
 * with ExtensionData null, PropertyChanged null and a valid Value
 *
 * orgReference is a CRM.CRMWebServices.EntityReference
 * with a valid Id
 */
newContactProperties.Add("parentcustomeridtype", organizationType);
newContactProperties.Add("parentcustomerid", orgReference);
var entity = new Entity();
entity.LogicalName = "contact";
entity.Attributes = new AttributeCollection();
entity.Attributes.AddRange(newContactProperties);
client.Create(entity);
This gives me error 'Attribute parentcustomeridtype must not be NULL if attribute parentcustomerid is not NULL'
I am puzzled why this happens and how I can solve this problem. Please help me if you can.
Thank you, AllWorkNoPlay