Inserting date/time field from UI Page using jelly

Bard H Rynning
Tera Contributor

I'm trying to insert a value collected from a UI page into a field on my form. Jon Snow knows more a about Jelly than I do and he knows nothing. UI page is triggered using a UI Action on the form. Below is the HTML field on the UI Page:

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:ui_choicelist name='HoldReason' table='sn_hr_core_case_norway' field='u_hold_reason_hr' />

<br />

<br />

<g:ui_date_time name="DateTime" table='sn_hr_core_case_norway' field='u_scheduled_date_time'/>

      <br />

<g:dialog_buttons_ok_cancel ok="return updateOnHold()"/>

</j:jelly>

And here is the client script part:

function updateOnHold() {

var reason = gel('HoldReason').value;

var time = gel('DateTime').value;

g_form.addInfoMessage("Dette er time: " + time); //Evaluates correct time

  g_form.setValue('u_hold_reason_hr', reason);//Set 'On Hold Reason' field with the chosen reason

g_form.setValue('u_scheduled_date_time', time);//Set 'Scheduled date time' field with the chosen date and time <-- Value not inserted!!

  g_form.save();

  GlideDialogWindow.get().destroy(); //Close the dialog window

  return true;

}

- In line 4 i can print the correct value in my variable called time. But this value is not saved correctly in the in the fowm on line 9.

- The value set for reason works and is saved on the form using almost the same logic. Only difference is that the u_scheduled_date_time is of type datetime in SN.

- The u_scheduled_date_time field is a task table field. I've created ACL for it so you can write to it. This whole thing is running i the HR application scope. If i try to save a value in the u_scheduled_date_time field in the form using save, that works.

Any ideas?

1 REPLY 1

Subhrajit2
Giga Contributor

Hi BÃ¥rd,



Is the "u_scheduled_date_time" field visible on the form where you have this GlideDialog window? Generally, g_form only works if the field is present on the form. Can you please provide the two data values (value of time variable and u_scheduled_date_time field after saving the record).



Regards,


Subhrajit