How to autopopulate fields from the same reference table in Service portal form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 04:49 PM
Hi All,
I am working on a form in service portal and have 2 reference field from the sys_user table. One is "user id" and the other is "email address". I added the fields but I can't figure out how to:
1- Populate the "user id" instead of the "user name" in the "User Id" field
2- Populate the "email address" instead of the "user name" in "Email address" field
3- Make to when user id is populated the email address is also populated and vise versa. When users' email is selected, the "user id" will auto populate.
Any advice will be greatly appreciated. Thank you in advance.
Kind regards,
Wendy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 05:22 PM - edited 11-28-2023 05:23 PM
Hi @Wendy20 ,
If u r working on Utah version then u can try the Auto populate functionality or check the below link please
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2023 07:44 AM - edited 12-03-2023 07:45 AM
Hi @Wendy20
Hope you are doing great.
For reference Field what value would be populated , that depends on "Display Value" field on user table.
Go tosys_dictionary , search for sys_user table and check which field has been set as display true. There is a possibility that its " user name ".
You should not change the display field , what you can do is,
Option 1 -
Change the field type to Single Line text. Write a script include , call that script include from client script using GlideAjax , to glideRecord on sys_user table in script include side and return both email and id to client side . on client side do se value to respective field as needed.
Option 2 -
Use a different field type eg. Look up select box ; give the field expected field name in
Lookup value field | lookup_value
Kindly consider marking the provided answer as correct if it proved helpful or mark helpful if it has contributed in someway to your query
Thank you and best regards,
Anwesha