The CreatorCon Call for Content is officially open! Get started here.

Glide list field on user

SM16
Tera Expert

I have a form (custom) which has glide list field for User table. Glide list field shows users full name. I am sending a report to the user with with glide list. Users have the ability to update the data via email.

Issue here is, while sending the report to the user, I am sending the glide list value as full name since dot walking is not supported for glide list. And while accepting an email with excel template I am asking user to send me email address instead of full name since name can be duplicate.

Users are now complaining, stating send us the email only if you want us to send you the emai.

What would be the optimal solution for this? I am thinking of creating a new string field on the form to store email ids of the users whenever a value changes for Glide list field of the user.

What's your thoughts on this?

1 REPLY 1

indian army
Giga Contributor

Your approach seems to be a good solution to the problem. Here are the steps you can follow:

1. Create a new string field on the form to store email ids of the users. Let's call this field "Email List".

2. Create a Business Rule or a Script Include that triggers whenever the Glide List field changes.

3. In this Business Rule or Script Include, iterate over the Glide List field to get the sys_id of each user.

4. Use these sys_ids to get the email addresses of the users from the User table.

5. Concatenate these email addresses into a single string, separating each email with a comma or semicolon.

6. Store this string in the "Email List" field.

7. When sending the report to the users, use the "Email List" field instead of the Glide List field.

8. When accepting an email with the excel template, ask the users to send the email addresses instead of full names. This way, you are maintaining consistency in what you send to the users and what you ask from them. Also, you are avoiding the issue of duplicate names.

Here is a sample code for the Business Rule or Script Include:

javascript

var userList = current.glide_list_field.getDisplayValue().split(',');

var emailList = '';

for (var i = 0; i < userList.length; i++) { var user = new GlideRecord('sys_user');

user.addQuery('sys_id', userList[i]);

user.query();

if (user.next()) { emailList += user.email + ',';

}

}

current.email_list_field = emailList;

current.update();

 

Please replace glide_list_field and email_list_field with the actual field names.       

 nowKB.com