Setting dates to null in the SalesLogix web client

Most dates in the SalesLgix web client are nullable DateTimes meaning that they do not need to contain a value.  However if you try code like this:

lead.LastCallDate = lastHistory.HasValue ? lastHistory.Value: null;

You will receive an error about how you can not implicitly convert a DateTime to null.  The reason for this is more in the syntax of the line of code that the ability to set a date to null.  When C# tries to evaluate the if else clause it is detecting that in one case it is using a DateTime but in another it is using just null.  These to data types do not compute (ha).  Instead what you need to do is just explicitly convert your null to a DateTime? null value like this:

lead.LastCallDate = lastHistory.HasValue?lastHistory.Value: (DateTime?)null;



Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!