Is there way to create an inactive record by plugin in Microsoft CRM 2011? I can use setStateRequest
class and IOrganizationService.Execute
method to change state/status of an existing record. Since this method needs the record Id, It can't be use on a new record.
Is it possible to create immediately an inactive record or do I have to create a new active record and deactivate it after the creation?
Setting the state/status directly (even on a new record)
EntityToSave["statecode"] = new OptionSetValue(state);
EntityToSave["statuscode"] = new OptionSetValue(status);
leads to an error:
2 is not a valid status code for state code ProductState.Active on product