Using g_form.setValue() on a Duration field does not work correctly if you pass the value from another Duration field. The field will show the value correctly, but saving the record does not commit the change. However, if you set the value of the field and then click within one of the inputs for the field, then the change is committed.

Steps to Reproduce

1. Add a Duration field to the Incident form. Call it 'test_duration'
2. Open an incident record and add a value to the Duration field. Copy the sys_id of the Incident record and Save.
3. Create an onChange client scirpt on short_description. In the script, use GlideRecord to get the incident you copied the sys_id for and use g_form.setValue() to copy the Duration field from GlideRecord into the current record.
4. Open a different Incident record and change the short_description to trigger the script (you might have to click out of the input field)
5. Notice that the value was copied into the Duration field successfully. Save the incident.
6. Go back to the same incident and notice that the Duration field was saved correctly (still shows all 0's)
7. Try again, but this time when the value for Duration is changed, click within one of the inputs for the field. Save the record.
8. Go back to the incident and notice that the value was saved correctly.


After carefully considering the severity and frequency of the issue, and risk of attempting a fix, it has been decided not to address this issue. We do not make this decision lightly, and we apologize for any inconvenience. If you have any questions regarding this problem, contact ServiceNow Customer Support.

Related Problem: PRB1274011

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-10-31 17:04:51