Windows Online Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 12 August 2008

Working with Null Values in MS CRM

Posted on 05:18 by Unknown

When you update an entity instance there is a mechanism you can use to differentiate the absence of a value from a null value. To set an attribute value to null you must set both IsNull and IsNullSpecified to true. For attributes of type String, you must assign the value to String.Empty. This same mechanism is used when you create a query to find a null value.

Another option is to use the type helper code available in Microsoft.Crm.Sdk assembly and in the CRMHelpers classes.

Example

The following code example shows you how to create null instances of the various Microsoft Dynamics CRM attribute types.

CrmBoolean boolean = new CrmBoolean();
boolean.IsNull = true;
boolean.IsNullSpecified = true;
 
CrmDecimal dec = new CrmDecimal();
dec.IsNull = true;
dec.IsNullSpecified = true;
 
CrmFloat f = new CrmFloat();
f.IsNull = true;
f.IsNullSpecified = true;
 
CrmMoney money = new CrmMoney();
money.IsNull = true;
money.IsNullSpecified = true;
 
CrmNumber number = new CrmNumber();
number.IsNull = true;
number.IsNullSpecified = true;
 
Lookup lookup = new Lookup();
lookup.IsNull = true;
lookup.IsNullSpecified = true;
 
PickList list = new PickList();
list.IsNull = true;
list.IsNullSpecified = true;
 
Status status = new StatusV();
status.IsNull = true;
status.IsNullSpecified = true;
 
Owner owner = new Owner();
owner.IsNull = true;
owner.IsNullSpecified = true;
 


Example

The following code example shows you how to create null instances of the various Microsoft Dynamics CRM attribute types using the type helper classes.

CrmBoolean boolean = CrmBoolean.Null;
 
CrmDecimal dec = CrmDecimal.Null;
 
CrmFloat flt = CrmFloat.Null;
 
CrmMoney money = CrmMoney.Null;
 
CrmNumber number = CrmNumber.Null;
 
Lookup lookup = Lookup.Null;
 
Picklist list = Picklist.Null;
 
Status status = Status.Null;
 
Owner owner = Owner.Null;

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in MS CRM | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • "Titan" Microsoft CRM 4.0
    Currently the "Titan" Microsoft CRM 4.0 is in CTP. New version of Microsoft Dynamics CRM delivers the power of choice to customers...
  • Writing the Plug-in Constructor
    The Microsoft Dynamics CRM platform has special support for a plug-in constructor that accepts two string parameters. If you write a constru...
  • Declare Global Access Level functions in MS CRM Form.
    Global functions in MS CRM Form. The way CRM adds the javascript to the page, any function defined in the onload event will only have a loca...
  • Crystal Report 4.6 - Error 20540; Missing or out of date Export DLL
    I was happen to install Crystal Report 4.6. for one of my project. As soon as I call the Crystal Report via VB 6.0 Code, i got the below err...
  • Debugging a Plug-in
    The following steps describe how to debug a plug-in. 1. Deploy the plug-in assembly. Copy the assembly to the standard plug-in folder on the...
  • Microsoft Dynamics CRM SDK Version 4.0.9 Released
    Download this new version of the SDK or view it on MSDN . This release provides continuing support for the on-premise user and new informat...
  • Create CustomerOpportunityRole Record
    This is a very simple code, when you wants to create a CustomerOpportunityRole. try { // Create the class customeropportunityrole oppRole = ...
  • Passing / Sharing Data Between Plug-ins
    The message pipeline model provides for a PropertyBag of custom data values in the execution context that is passed through the pipeline and...
  • Callout vs. Workflow
    You might find yourself wondering when you should use a pre- or post-callout versus when you should use a workflow rule. As you would expect...
  • To download all mother board driver CD
    http://driverpool.blogspot.com

Categories

  • .NET
  • .NET String Methods
  • Adapters
  • Aggregate Functions
  • All Elements
  • Associated Records
  • Azure
  • BizTalk Adapter
  • Callouts
  • Child Pipeline
  • Crm 2011
  • Crm 2011 Beta
  • Crm 2011 Beta - Ribbons
  • Crm 2011 Beta Installation
  • CRM Online 2011
  • Customizations
  • Database
  • Debug
  • Deployment Service
  • Dynamic Entity
  • Email
  • FetchXml
  • FileSync
  • Form Assistant
  • Hide Button
  • IIS
  • Integration
  • Internet Connectivity
  • ISV
  • Java Script
  • Lead Capture
  • MS CRM
  • MS CRM 2011 RC
  • MS CRM 4 Roll Ups
  • MS CRM 5 Features
  • MS CRM Accelerators
  • MS CRM Entity Schema
  • MS CRM Global Variable and Functions
  • MS CRM Templates
  • Pivot Tables
  • Plugin Constructor
  • Plugins
  • Reports
  • s
  • Save Record
  • SDK
  • Sharepoint
  • Sharepoint 2010
  • Sharing Data Between Plug-ins
  • Social Networking
  • SSRS
  • Tabs
  • Tracing
  • Videos
  • Visual Studio 6
  • VPC
  • WampServer
  • Windows Service
  • Windows XP
  • Workflows
  • xRM

Blog Archive

  • ►  2013 (4)
    • ►  September (4)
  • ►  2012 (8)
    • ►  September (1)
    • ►  July (7)
  • ►  2011 (12)
    • ►  July (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (8)
  • ►  2010 (27)
    • ►  December (1)
    • ►  October (3)
    • ►  September (10)
    • ►  August (2)
    • ►  July (5)
    • ►  June (5)
    • ►  February (1)
  • ►  2009 (41)
    • ►  December (1)
    • ►  November (5)
    • ►  August (3)
    • ►  July (2)
    • ►  June (3)
    • ►  May (9)
    • ►  April (2)
    • ►  March (5)
    • ►  February (7)
    • ►  January (4)
  • ▼  2008 (33)
    • ►  December (7)
    • ►  November (3)
    • ►  October (1)
    • ►  September (7)
    • ▼  August (4)
      • Create and Send Email Activity
      • Working with Null Values in MS CRM
      • Set Default Value to a Lookup Attribute using Java...
      • Create Note and Assign to a Entity.
    • ►  July (1)
    • ►  February (4)
    • ►  January (6)
  • ►  2007 (11)
    • ►  October (3)
    • ►  September (1)
    • ►  August (3)
    • ►  July (4)
Powered by Blogger.

About Me

Unknown
View my complete profile