K2 cannot save empty dates

  • 2 February 2017
  • 3 replies
  • 82 views

Badge +6

Good morning,

 

On a K2 view I have 2 date fields. They are not requiered on the view, neither in the sharepoint list where they are saved and also  they are not requiered on the smartobject.

 

But when I run the form and try to save data K2 pop ups an error (see screenshot attached).

 

My question is, how can I save a blank/empty/null date field on sharepoint list?

 

Thanks

 

Will.


14497iCEF37EDE1C824136.jpg


3 replies

Badge +9

Hi LDWill,

 

       As per my knowledge with SharePoint 2010,  ListItem doesn't allow empty or null datetime. But there is a workaround for this, you can pass minimum Date value i.e. 01/01/0001 while your date is empty.

 

 Sharepoint consider 01/01/0001 as minimum date value . In your form  use inline function to check datetime if it is empty then replace it with minimum Date  value i.e. 01/01/0001 else pass actual date.

 

And while you are displaing datetime on Smartform control  again use inline control to convert 01/01/0001 back to empty value. 

Badge +6

Kran,

 

thanks for the answer. It looks like a good workaround.

 

Can you explain me the last part of it?

 

And while you are displaing datetime on Smartform control  again use inline control to convert 01/01/0001 back to empty value. 

Thanks,

 

Will

Badge +9

Hi LDWill,

 

                I mean to say, In case you want to display date field on form  then by default it will appear as 01/01/0001, so to avoid it from displaing as  wrongly, you need to replace back this with Empty string as we are considering Empty date  as 01/01/0001  while adding data to SPList item.

 

 

during form initlization  you can add rule to do this.

Reply