When trying to define a statuscode
custom value using InsertOptionValueRequest
, I'm getting the following message:
When creating a new status value, you must provide what state value that status is associated with
What I currently have is:
var response = orgContext.Execute(new InsertOptionValueRequest
{
AttributeLogicalName = "statuscode",
EntityLogicalName = "op_employeragreement",
Label = new Label("Under review", 1033),
Value = 2
});
How am I supposed to provide an associated state
? These are the class properties (taken from Microsoft.Xrm.Sdk.dll, v7.0.0.0
(CRM 2015):
namespace Microsoft.Xrm.Sdk.Messages
{
[DataContract(Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class InsertOptionValueRequest : OrganizationRequest
{
public InsertOptionValueRequest();
public string AttributeLogicalName { get; set; }
public Label Description { get; set; }
public string EntityLogicalName { get; set; }
public Label Label { get; set; }
public string OptionSetName { get; set; }
public string SolutionUniqueName { get; set; }
public int? Value { get; set; }
}
}
As you can see, it doesn't contain a State
property.
Pretty sure you are using the wrong thing; InsertOptionValueRequest
is for option sets (picklists). Status selector doesnt fall into category.
I think you want to be using InsertStatusValueRequest
, see here.