Hello
Hello.
Hello. The state and status codes are listed on this website: Default status and status reason values
To get a list of all state and status codes using the SDK, I just can think of 1 possibility: using the CRMSvcUtil tool.
Go to <CRM SDK>\SampleCode\CS\CrmSvcUtilExtensions\GeneratePicklistEnums, open the solution and change the
FilteringService.cs file:
public bool GenerateOptionSet(
OptionSetMetadataBase optionSetMetadata, IServiceProvider services)
{
if (optionSetMetadata.OptionSetType == OptionSetType.State || optionSetMetadata.OptionSetType == OptionSetType.Status)
return true;
return false;
}
Build the solution and go to <CRM SDK>\SampleCode\CS\CrmSvcUtilExtensions\GeneratePicklistEnums\bin\Debug
Open the GenerateOptionSets.bat file in a text editor and change the lines:
/url:<organizationservice url> (CRM->Settings->Solutions->Developer Resources) ^
/out:<filename>.cs
Add a PAUSE statement to the end of the bat file. If you run the bat file, you'll get a c# file with the enums of the state and status codes of all entities in your organization. Example:
public enum lead_statuscode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
New = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
Contacted = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
Qualified = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
Lost = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
CannotContact = 5,
[System.Runtime.Serialization.EnumMemberAttribute()]
NoLongerInterested = 6,
[System.Runtime.Serialization.EnumMemberAttribute()]
Canceled = 7,
}
Hope this helps,
Kind regards