When a field is dot-walked it can not be set read-only (setReadOnly)


Description

It is not possible to make a field read-only by setReadOnly when the field is dot-walked.

Steps to Reproduce

This issue is reproducible when the reference field value is set by the same client script making the dot-walked field read-only.

1. Go to sys_user table and fill out the value of city for Abel Tuter's record

2. Go to incident table and add "caller_id.city" field on the form

3. Create a new onload Client Script with script code as below (sys_id is the Abel Tuter's sys_user record)

g_form.setValue("caller_id","62826bf03710200044e0bfc8bcbe5df1");
g_form.setReadOnly("caller_id.city",true);

4. Go to incident > Create new

Observe the "City" field is not read-only.

Workaround

In Client Script, do not call g_form.setValue(dot_walk_parent_field) & g_form.setReadOnly(dot_walk_children_field) back to back. Either use a setTimeout() function to delay few milliseconds between the two calls or create a UI Policy do setReadOnly on dot_walk_children_field.


Related Problem: PRB1504676