If you try to populate a GlideList field using a script, you can end up with different values in your table, depending on the way you do it.
GlideList fields such as the Watch list and Work notes list can store 2 types of values:
- Users (sys_ids of Users in the sys_user table)
Usually, you will want to save references(sys_ids) for users in the system and emails for external users or distribution lists.
Let’s see it with a simple example with only two users.
- Abel Tuter → Using his email as User ID
- Abraham Lincoln → Not using his email as User ID
Option 1: Match emails to UserIDs
If we update the GlideRecord using “gr.field = value”, Servicenow will try to match emails to UserIDs in the sys_user table. It will replace the values by the sys_ids if found.
Option 2: Save the email address
If we use “setValue” instead, the email address is stored in the GlideList even if a user with that UserID exists in the system.