Thursday, June 2, 2011

Invalid argument for field "incomingemaildeliverymethod" in systemuser

Hi,
 
Valid values for Picklist in CRM 3,4,2011 start from 1, 2. Values empty or 0 are not valid.


Example for picklist values:

Value                Name

0                                              Israel

1                                              USA

2                                              Holland



I have found a pick list with empty value.

Problem appears in Systemuser field incomingemaildeliverymethod.



The field incomingemaildeliverymethod values start from 2 and the first value is empty.



If I try to create new systemuser and set value for this field in pre create event values 0 or empty error message “Invalid argument “



The solution is to create a new field Picklist and set the value like that:



Microsoft.Crm.Sdk.Picklist incoming = new Microsoft.Crm.Sdk.Picklist();

incoming.name = "ללא";

// Set values for this field in pre create

ContextUtils.SetProperty(context, "incomingemaildeliverymethod", incoming, typeof(PicklistProperty));

Now the set values works correctly

Thanks,

Rami Heleg