Home

Jul 8, 2007

Set a lookup to NULL


How do I set a lookup to a NULL value?

Here is the answer for when you're working in server side code:

Entity.Lookup = new Lookup();
Entity.Lookup.IsNull = true;
Entity.Lookup.IsNullSpecified = true;

this also works for customers:
contact.parentcustomerid = new Customer();

contact.parentcustomerid.IsNull = true;
contact.parentcustomerid.IsNullSpecified = true;

If you're working in a client side javascript, then use this approach:
crmForm.all.lookupschemaname.DataValue = null;


Thanks,

No comments: