The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Multiple reference fields from the same ref table

lzeke
Giga Contributor

I am new to ServiceNow, so forgive me if I ask something stupid.

I have a "main" table and a reference table called "ref". The reference table has two string columns "column1" (the "display" column) and column2. I created a form for my main table and next to its columns, I also want to show these two columns from my reference table. Also, when I select a reference record using column1 on this form, I assume that the form's column2 field will also be updated from the selected "ref" record. Simple enough.

(I am using Fuji.) To show column1 on the form I just used "ref" (since column1 is the display column), and I used dot walking for column2 (ref.column2). Both of these fields became drop downs on my main form. (I hoped that column2 will be just a string. Anyway, this was still OK.) The surprise came when I selected a record in my "ref" field (that is column1), since I could also select a value for column2 and when I saved my main record my "ref" table record got also updated with the value combination that I selected.

Being able to select both reference fields is not bad (actually, quite nice for the user), but I assumed that when I select one of them, the other will be automatically updated. This is clearly not the case - selecting a value for column2 doesn't update the field for column1. So, I am looking for a solution that either achieves this, or gives me column2 just as a read-only string field. (And by all means, I would never want the user to be able to update the ref table through this form.)

How to achieve this? Clearly, I can define a string field for column2 and use scripting to populate this field whenever column1 is changing, but I hoped that there is some simple configuration solution instead of scripting.

Any ideas?

1 ACCEPTED SOLUTION

Hi Laszlo, I am running Fuji glide-fuji-12-23-2014__patch3-04-07-2015 i see this problem is fixed,hence if you manage to get the next patch the problem will be solved 🙂 as i told it is a known problem,check link below https://community.servicenow.com/thread/181577


View solution in original post

9 REPLIES 9

Deepak Ingale1
Mega Sage

please Provide screen captures to get an idea of what is required and what is configured so far


Ahmed Drar
Tera Guru
Tera Guru

Hi Laszlo ,


I hope i understand you correctly you can use field dot walking to show some fields related to the reference field for instance . you can field caller_id.email , so once you select the caller this field would be updated make sure to create UI policy to set caller_id.email   to read-only so not to confuse the user . you can also search by more the one value in your reference field by adding ref_ac_columns in the dictionary


Untitled3333.png


Untitled222.png


lzeke
Giga Contributor

Thanks for the replies, gentlemen. Let me try to explain a bit better with a screen capture.



To demonstrate the problem I created two tables: Car-ownership and Car.



The Car-ownership table is the main table with two columns: owner_name (string) and car_info (reference to the Car table).


The Car table has two fields: make (string), and previous_owner (Reference to sys_user)



I created my Car-ownership form with 3 fields (see below) and you can also see the form-layout spec below. And I created a UI policy to set the Previous owner field to read-only unconditionally.



When I choose a car in the "Car info" field below, my "Previous owner" field is properly filled out from the Car table's record. This is what I expect.



Here is the surprise: even though, I have set the "Previous owner" field read only (you can see the gray coloring on the field to prove it) I can STILL select an arbitrary value for it (the looking glass is not grayed out) and when I save the record, both the Car owner and the Car table records are updated.



How can I avoid this?


sn.png


Do following.


click on debug security,


Find the ACL for table car ownership and for field previous owner.


There might be the case that, for that field ACL, you might have 'ticked'   "admin overrides" option. This will allow admin to override ACL.


Please check and let me know.