List field displaying sys_id rather than name after being saved

Sam Ogden
Tera Guru

Hi All,

We have created a list field on our incident table called u_escalated_to.. This is a reference to the sys_user_grmember table and has a simple filter of Group is SM Managers.

When you first select the name in the list it displays correctly.

find_real_file.png

Once you save the record it is displaying as the Sys_ID

find_real_file.png

Any suggestions on how to get it to retain the name rather than the sys_id?

Any help is greatly appreciated

Thanks

1 ACCEPTED SOLUTION

Sorry Sam. Mistake on my part. Go to the script include and change the line:



list.push(grm.getValue('sys_id'));



to



list.push(grm.getValue('user'));



The list was creating a bad list of sys_ids.


View solution in original post

36 REPLIES 36

jarodm
Mega Guru

I would recommend linking to `sys_user` instead of `sys_user_grmember`. You can still do a reference qualifier to limit results to that group. I would recommend adding a reference qualifier for active=true as well.




Chuck Tomasi
Tera Patron

The reason is because sys_user_grmember doesn't have a display=true set on any field. The main reason for this is because it's a many-to-many table.



What I recommend instead is to reference sys_user and then create an advanced reference qualifier on that field to get the sys_ids of the group members.



http://wiki.servicenow.com/index.php?title=Reference_Qualifiers


Hi Chuck,



Thanks for the above.   How do you find out that display does not work on a table so we can avoid this going forward?   Only asking as we set display to true on the user field on the sys_user_grmember table:



find_real_file.png



In regards to the advanced reference qual, I'm not too sure on how best to do this to achieve the list to just show members of the group SM Managers?



Any ideas



Thanks


If you are referencing a many-to-many table (such as sys_user_grmember) there won't be a display value. That's the most common place. Any others are generally because the person who created the table forgot to set a display value - those are usually quickly remedied in development or test soon after.



Be careful of setting a display value on a many-to-many table as you did. It could have ramifications elsewhere. Check the user list in a group and check the group list in a user to make sure it is displaying properly in both places. I haven't tested this, but something tells me you might ask to look at a list of groups for that user and see a list of users... Double check please.



For more information on advanced reference qualifiers, see section 4.3 here:


http://wiki.servicenow.com/index.php?title=Reference_Qualifiers#Advanced_Reference_Qualifier_Example