ui page client script not working

El Cuchi
Tera Guru

Hi All,

 

SITUATION

I am trying to simulate the time worked form with a ui page.

I created a ui action (button) that calls the page. the it staff enters details and time. Then, record is added to task_time_worked table.

 

PROBLEM

The original problem is that totalSeconds contains the time in seconds but when inserted does not have in consideration that snow works with different time (1970-01-01 00:00:00) and when inserting record looks like '2023 28-11 06:00:00'. Then, when looking at the time worked form shows 19690 days 1 hour 20 mins.

 

Today i added a script include called from the client script section and at the end shows the right value '1970-01-01 00:01:30', but i dont know how to assigned it to the 'time_worked' variable so it is inserted in the duration field within the 'task_time_worked' table.

 

code attached.
3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

Hi @El Cuchi 

The Duration field type is expecting the value in the format "ddd hh:mm:ss." After your calculation, ensure that you return the duration in this format. Set this formatted value for the duration field, and it should work.

 

Ref: Calculate difference bet two dates and set duration.

 

Cheers,

Tai Vu

El Cuchi
Tera Guru

This is how i solved my problem.

 

I passed all values to the script include where i calculate the time work field and now i also insert the record in the script include rather than returning the duration to the ui page and try to insert it from there.

 

thanks all !!

El Cuchi
Tera Guru

i just solved the problem by not only passing the duration value to the script include but also passing all values. Also i do the insert from the script include rather than trying in the client script within the ui page.

 

thanks all !!