If you have a field that is dependent on a reference field and then call g_form.setValue on it as well as the reference field in an onLoad client script, it will not work in the service portal. This is most likely because the dependency check is happening after the onLoad script so it clears out the value of the dependent field.

Steps to Reproduce

1. Navigate to an incident form
2. Right-click the Urgency field and choose Configure Dictionary
3. Change to the advanced view if needed.
4. In the Dependent Section, check the box for use dependent field and set the Dependent to the Assigned to field(or any reference field).
5. Save the form, then in the Choices related list set the Dependent Value of one of the choices to be the sys_id of a user record
( 46d44a23a9fe19810012d100cca80666 is the sys_id for Beth Anglin OOB. )
6. Go Back to the incident form and verify that when you set the Assigned To to Beth Anglin you choice shows up, and when assigned to is set to any other value the Urgency is cleared out.
7. Create an onLoad client script on Incident which sets the value of Assigned To to Beth and the value of Urgency to the field you edited. (attached one as well)
Example script to add:
g_form.setValue('assigned_to', '46d44a23a9fe19810012d100cca80666');
g_form.setValue('urgency', '2');
8. Go back to the incident form in the normal UI and see that both the assigned to and Urgency fields are correctly set when the form loads.
9 Go to the form in the service portal by adding the below params to your URL.

The value of the Urgency field is being cleared out because of the dependency check happening after the form loads.


This problem is fixed in all currently supported releases. Review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.

Related Problem: PRB1272455

Seen In

Kingston Patch 4
SR - ITOM - CMDB CI Class Models - 201907
SR - ITOM - Fundamentals Istanbul Jakarta Kingston r1 - v5.99.6

Fixed In

New York

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-07-19 04:18:04