Skip to content
+1-888-319-3663

COMMUNITY FORUM

ERROR: Parameter set value event. Object cannot be cast from DBNull to other types.

Tudor asked 8 years ago
I'm trying to sync a date field from GP 2010 to CRM 2011 but I keep getting this error "Error in 'MsCrm2011Destination'. Line 'account'. Parameter 'Billing End Date'. Parameter set value event. Object cannot be cast from DBNull to other types." 

The CRM field is a text field while the GP field is a date. I know in GP not every single entry into the field is populated so there are NULLs. I've also tried having the CRM field as a date field but I'm still getting similar issues. 

If there is no value for the date in GP can SmartConnect just not enter anything (leave the field blank) into CRM? I guess that is what its doing right now but would it be possible to get rid of these errors?

Thanks for any help!
Answers
Best Answer
kevin answered 8 years ago
Tudor,
 
Create a calculation column for your date that tries to convert it to a date, if that fails return an empty string. That way you will be able to update your string field in CRM without any errors showing up.
 
VB.Net calculation code
 
Try
  return Convert.ToDateTime(_DATE_ONE).ToString() 
Catch 
  return string.Empty
End Try
 
C#.Net calculation code
 
try {
  return Convert.ToDateTime(_DATE).ToString(); }
catch {
  return string.Empty; }
 
regards
Kevin
Tudor replied 8 years ago

Thanks Kevin, that worked! 

Just for my information, is there any reason I should use VB vs. C# or vice versa? Support dropping for either of them soon? Just wondering 🙂

kevin replied 8 years ago

Tudor,

Personal preference determines whether C# or VB should be used. The languages are slightly different and people use whichever one they get comfortable with. As far as SmartConnect goes there are no plans to drop either language.

Kevin


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