Simple reference qualifier on lookup select box

kim-lindgren
Kilo Sage

I have three tables: Booking, Room, and Room type.

 

On the Room table, I have a reference field "room_type" that refers to the display value "name" on Room type. 

 

For the Booking table, I have three record producers (RP). Each RP should create a booking for a room of a particular room type. The three room types (records on the Room type table) are: "small_room", "medium_room", "conference_room".

 

On each Booking RP, there will be a unique Room type variable. The Room type variable is a lookup select box that needs a reference qualifier to show only rooms of the correct room type. I really think the qualifiers should be "room_type=small_room", "room_type=medium_room" etc, but it simply does not work. The Lookup Select Box comes back empty. If I do not enter a qualifier, I get all rooms of all types.

 

I'm sure someone will be able to spot the error. I am of course happy to provide additional information as needed.

 

Thanks.

1 ACCEPTED SOLUTION

Depending on what is the type of field "Room Name" the setup might not be correct. Option "Lookup value field" on the Lookup Select Box variable indicates which will "provide" the value  for a choice to store in the database. If "Room Name" is a reference, then Lookup value field has to be Sys ID. Only if Room Name is a field of type Choice, or String with option to display as choice, would this setting be possibly correct.

You should also specify a value in Lookup label field(s). That decides which field(s) of the table providing the choices (in this case Room type) to list in the Lookup Select Box when someone "drops-down" the Select Box. Not knowing the structure of work hub room, it is har for me to say which fields are appropriate/valid.

Lastly, if you allow me an advice, that also ties into how to "build" in harmony with ServiceNow established practices, but also generally accepted best practices, don't name fields Something Name. Unless it is really a name that is stored in that field. But even then, if you have a table Something, you should create a reference field instead and name it Something.

E.g. if you open an Incident record and look at the form/table, you will notice that it contains references to other records in other tables - like Problem (reference to table Problem) or Opened by (reference to table User) - on those fields are not called Problem Number or Opened by Name, even though that is what is displayed in those fields: the number of the reference problem record and the name of the user that opened the Incident.

Using and attribute of a record to refere to a record is also bad, because it will not be possible to differentiate between when someone references the Room Name vs the Room record (both will be called Room Name if you name references like that).

View solution in original post

11 REPLIES 11

-O-
Kilo Patron
Kilo Patron
The Room type variable is a lookup select box that needs a reference qualifier to show only rooms of the correct room type

So the variable where one selects rooms is called "Room type"? Also, may I ask why are you using a Lookup Select Box and not a Reference variable to enable selecting rooms?

I suppose "room" should be the actual variable, room type is just the filter needed.

 

I don't understand the differences between all the variable types yet. Now that I look at it I see that the reference field allows for simple filters that the lookup select box does not. The select box seemed very similar to the reference field in the docs, except that it gives you a more proper dropdown. Still not sure why it can't use simple filters, but I'll switch to the reference field. Thanks. 

Actually Lookup Select Boxes should also "just" work with reference qualifiers. That is not the reason why I asked about why not choosing reference. Select boxes are more "familiar"/standard type of controls, but they can only handle well small set of data. Reference variables handle well any size of data. Room types is a good candidate to show in a Lookup Select Box. Rooms, which in a middle sized company can be in the 100s are better handled in a Reference variable.

Back to the problem, perhaps if you could show a picture of the Lookup Select Box, someone could tell you what is not OK with the setup.

There would be less than ten rooms per room type in this case. 

 

This is the current setup for the select box variable.

 

kimlindgren_0-1673736535854.png