How to set the field value of the crmdatetime type to null (null)

Source: Internet
Author: User

How to store various types of mscrm values has always plagued me. Maybe it is because I have not studied it carefully. this is not a problem today: in the Web service provided by crm3.0, The crmdatetime type does not have the isnull and isnullspecified attributes. In this case, how can we set the field value of the crmdatetime type to null? The SDK does not address this issue. Please refer to the following section:

Assigning null values

When you update an entity instance there is a mechanic in place to differentiate the absence of a value fromNullValue. To set an attribute valueNullYou must set bothIsnulL andIsnullspecifiedToTrue. For attributes of TypeString, You must assign the valueString. Empty.

This is a text on msdn about the mscrm type, the original article here: http://technet.microsoft.com/en-us/library/aa685869.aspx. here we have basically introduced various types, but we have not mentioned how to deal with the crmdatetime type. it indicates that Ms's strength in CRM is not enough. At least the document update is not very timely. what should I do? Search results continue to flip back, patiently view, finally was found by me: http://www.crm.microsoftproducts.net/%5C/How-to-update-crmdatetime-field-to-NULL_-40404.aspx. originally, only a new crmdatetime is required. set its value attribute to null or. as follows:

Code
Task t =   New Task ();

T. activityid
=   New Key ();
T. activityid. Value
=   New GUID ( " {0f85395d-ad39-db11-9372-001438b86853} " );
T. scheduledend
=   New Crmdatetime ();
T. scheduledend. Value
=   String . Empty;

Service. Update (t );

 

That's easy! But if you don't try, how can you think of it?

 

Summary: various types of values in mscrm will be saved as null if you clear them on the page (clear the text box ).CodeIf this parameter is set to null, the preceding method is used to set null values for various types.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.