Skip to main content

Hi All,

 

In a Sharepoint List , I have a column DueDate of type DatenTime and it holds date only

Ex: 2016/01/13

 

But the column when referred to in K2 gives the value as 2016-01-13T00:00:00.

 

1>I am not able to figure out how to remove T00:00:00

2>Conversion function ToDate in K2 for Sharepoint inline function returns the error " Unable to cast object of type 'System.Objectj]' to type 'System.IConvertible'. " 

3>COnversion function ToString returns Sytem.Obje]

 

I am dumbfounded.

 

Can anyone suggest the cause and resolution for this ?

 

Thanks and Regards,

Satya

 

 

Dear ,

 

If i understood u right , u mean by retreiving that date into k2 form Calendar , u get 2016-01-13T00:00:00.

 

well , if that was the scenario , then u need to go to ur calendar , right pane (properties) , change data type to "Date"

 

16620i306ECD085DC74898.png

 

Hope this helps!

Best regards.


Hi,

 

Are you seeing this in workflow or forms?  


Hi Mustafa,

 

I am not using Forms.

 

Actually I am seeing this in email body.

I am passing this date to an email which is being sent from K2 .

 

The workflow is designed using K2 for Sharepoint and is trigerred when an item is added to the Sharepoint list.

 

Thanks and Regards,

Satya


Some more information which has confused me.

 

DueDate > Now is working , where Now is an inline function

but Due Date = AddDays(Now, 10) is not working. 

 

What I mean here is comparison operator > or < is working but not "=". 

 

I will drill further into this and update this post.

 

Thanks and Regards,

Satya


Hi All,

 

I have attached 2 screenshots.
One contains the data in email . I am sending an email from K2 with DueDate being fetched from the Sharepoint list. The date in SP is 1/13/2016 but in K2 it becomes 2016-01-13T00:00:00.

 

It is because of this reason specifically, I am unable to do any cast operation using inline functions. Converting to String or Date gives the errors highlighted in the second screenshot.

 

Thanks and Regards,
Satya


10676i50D8FBF86AB9478B.jpg
16435iDB9AE86FE93CD109.jpg

Hi Satya,

 

Did you try to use the inline function "Format Date and Time" ?

 

I believe the conversion error refers to the T letter in the date, please check the attached video on how to take the time off the date.

 

let me know if it solves the issue

 

I am doing the inline function in data event, you can do it in your email and you just need to change the date i am using to your date property.

There are other workarounds that solves the issue, if this doesn't work, try to replace the T letter with empty string then convert to date.


Hi Mustafa,

 

Thanks for sharing the video.

 

The video depicts usage in K2 Studio.What I understand is that there is no data event in K2 for SharePoint. 

I will still give it a try in K2 for SP but I guess I may again get the Datatype conversion error.

 

Thanks and Regards,

Satya

 


Hi Satya,

 

There is Set data field event which is the same, It's true I am using K2 studio but you can find the same functionality in the designer.

 

Please check the attached video

 

 

 


Hi Mustafa,


Thanks again for replying . I will definitely have a look into the video once I finishh posting this.

 

ISSUE RESOLVED !!! YIPEE

 

I used Today() inline function instead of NOW().

 

Ex:

Lets say DueDate = 01/18/2016

Today's date is 01/28/2016

 

Now from Sharepoint to K2 DueDate is passed as 2016-01-18T00:00:00

Now() returns date with time like  1/28/2016 7:20:26 AM

Today() returns date with time as 12:00:00AM , like 1/28/2016 12:00:00 AM .

 

So, if I use DueDate < Now() or Today() , it works fine as time part of Due Date is always 00:00:00

But if I use DueDate = AddDays (Now() (Date and Time), -10) , this fails as using Now() brings into consideration time part also. Hence I replaced Now() with Today() and it clicked as time part is constant in Today()

 

Thanks and Regards,

Satya


Reply