Skip to main content


 

Symptoms


Dates getting set to 2001-01-01 00:00:00
 

Diagnoses


Hi

We have a job table in our database with quite a few columns. As a job progresses through the workflow we update the status column with a different value. And this is done using the native smartobject "Update" method for the job table. However, lately, whenever the update method executes, it is updating all the datetime columns of the table with the default value of 2001-01-01 00:00:00 even when we are not passing that value to the smartobject.
I ran the SQL profiler while this process ran and found somehow these values are getting passed to the database query. Please refer the below query retrieved from the profiler:

exec sp_executesql N'UPDATE Edbo].]job] SET Tstatus_id] = @status_id, ,photo_date] = @photo_date, ,fc_user_created_datetime] = @fc_user_created_datetime, ,fc_user_last_edited_datetime] = @fc_user_last_edited_datetime, ,fc_user_submitted_datetime] = @fc_user_submitted_datetime, ,fc_user_deleted_datetime] = @fc_user_deleted_datetime WHERE Ejob_id] = @job_id',N'@job_id int,@jobname nvarchar(255),@ts_job_id int,@ts_jobkey nchar(8),@status_id int,@photo_date date,@franchise varchar(10),@fc_user_current varchar(255),@fc_user_created varchar(255),@fc_user_created_datetime datetime,@fc_user_last_edited varchar(255),@fc_user_last_edited_datetime datetime,@fc_user_submitted varchar(255),@fc_user_submitted_datetime datetime,@fc_user_deleted varchar(255),@fc_user_deleted_datetime datetime,@assets_upload varchar(255),@job_type_id int,@no_logo_required bit,@completed_datetime datetime,@time_in_production decimal(8,2),@time_on_hold decimal(8,2),@time_in_lab decimal(8,2),@ts_schoolkey varchar(10)',@job_id=2798,@jobname=NULL,@ts_job_id=NULL,@ts_jobkey=NULL,@status_id=11,@photo_date='2001-01-01',@franchise=NULL,@fc_user_current=NULL,@fc_user_created=NULL,@fc_user_created_datetime='2001-01-01 00:00:00',@fc_user_last_edited=NULL,@fc_user_last_edited_datetime='2001-01-01 00:00:00',@fc_user_submitted=NULL,@fc_user_submitted_datetime='2001-01-01 00:00:00',@fc_user_deleted=NULL,@fc_user_deleted_datetime='2001-01-01 00:00:00',@assets_upload=NULL,@job_type_id=NULL,@no_logo_required=NULL,@completed_datetime=NULL,@time_in_production=NULL,@time_on_hold=NULL,@time_in_lab=NULL,@ts_schoolkey=NULL

As you can see all the datetime parameters are getting set to '2001-01-01 00:00:00' by default.

Could you please help in troubleshooting this. Also let me know if you need any more information.

Thanks
 

Resolution


Appears that when compiling/deploying a WF . K2 uses the logged on User's Machine's Regional Settings (DT Format and MinDate settings) and hard-codes this into the WF . If that WF is then deployed to the Server and executed , the SMO Event that updates the DT values were using the Client machines Regional Settings and not the K2 Server's . This was resulting in invalid DT formatting which in turn caused the min-date issue

To fix we ensured that the machine used to build/deploy the solution has DT settings configured the same as the K2 Server




 
Be the first to reply!

Reply