Making reference field read only on a table without affecting underlying table

yundlu316
Kilo Guru

I have a table that that stores basic employee information (1) and another table (2) that has a reference field referencing the basic employee info table.   Through that reference field, I've also dot walked and picked up some additional fields from the basic employee info table.   I want to make some of these fields in table 2 read-only, but not read-only in the base table 1 (basic employee info).   Is there a way to do that?

I tried following the logic in this post: https://community.servicenow.com/thread/173149#734008, but couldn't find how to get to Dictionary Override as the instruction indicates.

Thanks!

1 ACCEPTED SOLUTION

I see what you are saying. You want to dot-walk to place them on the form. Correct. You would have to make them read-only on the original field.



In that case, the UI policy (or client) script is going to be your best solution unless you make new fields on table2 and copy the values from table1 instead of dot-walking. This is similar to how the OOB functionality works on the incident form when you see the caller's location. It takes a bit more scripting to copy over the values.



Thank you for your clarification.



FWIW, best practice suggests limiting the number of dot-walked fields from a reference table as it can be confusing to the user where the information actually resides. Using the hover-over icon is a better way to view information on a referenced record.


View solution in original post

17 REPLIES 17

I see what you are saying. You want to dot-walk to place them on the form. Correct. You would have to make them read-only on the original field.



In that case, the UI policy (or client) script is going to be your best solution unless you make new fields on table2 and copy the values from table1 instead of dot-walking. This is similar to how the OOB functionality works on the incident form when you see the caller's location. It takes a bit more scripting to copy over the values.



Thank you for your clarification.



FWIW, best practice suggests limiting the number of dot-walked fields from a reference table as it can be confusing to the user where the information actually resides. Using the hover-over icon is a better way to view information on a referenced record.


Hi Chuck, Table 2 extends Task and does NOT extend Table 1.   Table 2 has a reference field to Table 1 and through that reference, I pulled other fields from Table 1 into Table 2.   When I make those dot-walked fields in Table 2 Read-Only, the same exact fields in Table 1 also become Read-Only.   I "fixed" this issue by using the following Client Script onLoad:



function onLoad() {


    //Type appropriate comment here, and begin script below


    g_form.setReadonly('Table1.u_field_a',true);


    g_form.setReadonly('Table1.u_field_b',true);


    g_form.setReadonly('Table1.u_field_c',true);


    g_form.setReadonly('Table1.u_field_d',true);


    g_form.setReadonly('Table1.u_field_e',true);


}



Is this ok?   Thanks.


I agree with Robert. Since you are going with client side manipulation anyway, it's better to UI policies whenever possible.



In my example, I dot-walked the field 'Business Phone' from Assigned to reference field. When i select that field and make read-only true, it only makes it read-only on your current form. Not on the original form where it's brought from.


Screen Shot 2016-09-13 at 12.29.38 PM.png


How did you actually get to this screen?   If I right click and configure, I only see UI Policies or UI Actions, I don't see a choice for UI Policy Actions.   Thanks!


When you create a UI Policy, the UI Policy Action is a related list (shows up after the UI policy is created). The UI Policy Actions get executed for the UI policy. This is where you set the fields to read-only/mandatory/visible.



Screen Shot 2016-09-13 at 12.58.16 PM.png