- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:23 AM
Hi Team,
Please find the below screenshot
Username has the collector which contains the value as reference from sys_user table
For Example:
ameer@gmail.com
I need to write a client script to get those 3 value in comma separated and save it in below user id field
I have a client script for getting one value , Not sure how to get 3 values with comma separated
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var user = g_form.getReference('first_name', getdetails);
function getdetails(user) {
g_form.setValue('email', user.email);
g_form.setValue('user_id', user.user_name);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 07:40 AM
as per my requirement you code this helps me ,It displays the sys id to string like below
rekha@gmail.com,sal@gmail.com,halit@gmail.com
Code
******
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 07:19 AM
I answered something similar earlier
sample working script is here; enhance for your case
Populate Email Addresses of users selected in List Collector variable to Multi Line Text Variable
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 09:01 AM - edited 11-16-2023 09:02 AM
I tried this code but result is not coming , getting the value from sysparm_env and displaying in user_id variable
Script Include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 07:22 PM
the link I shared has a working solution.
Please refer that and enhance. Also debug it in terms of client side and server side
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 07:40 AM
as per my requirement you code this helps me ,It displays the sys id to string like below
rekha@gmail.com,sal@gmail.com,halit@gmail.com
Code
******
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 05:05 AM
Hi Saib,
I'm not entirely sure what the ask is here...
You want to populate a list collector field but from which other fields?
