Skip to content
+1-888-319-3663

COMMUNITY FORUM

How do I write a NULL value into CRM 2011 whole number field?

John asked 8 years ago
I am trying to map a SQL INT field that contains a NULL into a CRM 2011 field setup as a whole number in a custom entity but I am getting an error stating: Object cannot be cast from DBNull to other types.  How can I write a NULL into a CRM whole number field if the SQL field is a NULL?  My SmartConnect map has the Data Source of MSSQL table and the destination is a CRM 2011 custom entity.   Thanks.
Answers
Best Answer
Ruaan Jonker answered 8 years ago
Hi John

What you can do is create a calculated field to check the integer value of the data source and return whatever number you would like to return.
Then map the calculated field to the destination field in CRM.

VB
if (_MYINT = System.Int32.MinValue) then
     return 0
else
     return _MYINT
end if

C#
if (_MYINT == System.Int32.MinValue)
     return 0;
else
     return _MYINT;
 

John replied 8 years ago

Thanks Ruaan for your reply,

Instead of returning a number to the destination field is it possible to fill the destination field with a NULL like when I enter a record from the CRM front end? 

Thanks for your help.

John

Manny replied 5 years ago

I’m trying to insert a null value to CRM as well. Was this ever fixed?


If you would like to submit an answer or comment, please sign in to the eOne portal.