This documentation is archived and is not being maintained.

Type Creation Helpers

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

There are two places where you can find helper code for instantiating Microsoft Dynamics CRM types.

  • Microsoft.Crm.Sdk.dll – This assembly is added to all plug-in and custom workflows.
  • BusinessEntityPartialTypes.cs and PropertyPartialClasses.cs – These helper code files can be added to custom solutions that use the CrmService Web service.

The classes defined here contain overloaded constructors for each data type that allow you to instantiate and set the value.


The following sample shows you how to instantiate and set the value of each data type using the overloaded constructors for each data type.

CrmBoolean boolean = new CrmBoolean(true);

CrmDateTime dateTime = new CrmDateTime("2006/5/27T17:00:00");

CrmDecimal dec = new CrmDecimal(10.1);

CrmFloat f = new CrmFloat(10.2);

CrmMoney money = new CrmMoney(10.00);

CrmNumber number = new CrmNumber(10);

Lookup lookup = new Lookup(EntityName.systemuser.ToString(), user.UserId);

Owner owner = new Owner(EntityName.systemuser.ToString(), user.UserId);

Picklist list = new Picklist(1);

Status status = new Status(2);

EntityNameReference reference = new EntityNameReference(EntityName.systemuser.ToString());

Key key = new Key(user.UserId);

See Also



© 2010 Microsoft Corporation. All rights reserved.