The Zurich release has arrived! Interested in new features and functionalities? Click here for more

one or more email address was invalid,(local address containing illegal character

nandini29
Tera Contributor

Hi 
I am getting below error in test but same script is working in dev , could you please help on this

nandini29_0-1758182829830.png

email script I am using in send email

var recepients = fd_data._1__get_catalog_variables.select_list_of_users_to_send_emails;

var groupmembers = new GlideRecord('sys_user_grmember');

groupmembers.addQuery('group','4809499747cb4e90c996889d416d43d0'); // KA_Rating_ApplicationGroup sys_id

groupmembers.query();

while(groupmembers.next())

{

recepients += ","+ groupmembers.user;

}

return recepients;

Could you please help on this, Thank you!

3 REPLIES 3

palanikumar
Giga Sage

Hi,

Did you try to see what is returned from this function?

Sometime the GlideRecord will not convert to sys_id, so you can explicitly mention like below

     recepients += ","+ groupmembers.user.sys_id.toString();

 

Thank you,
Palani

RaghavSh
Kilo Patron

try below:

var arr = [];
var recepients = fd_data._1__get_catalog_variables.select_list_of_users_to_send_emails;

var groupmembers = new GlideRecord('sys_user_grmember');

groupmembers.addQuery('group','4809499747cb4e90c996889d416d43d0'); // KA_Rating_ApplicationGroup sys_id

groupmembers.query();

while(groupmembers.next())

{
arr.push(groupmembers.user.toString());
}
arr.push(recepients);
return arr;

 

Your current code should also work ,  you need to check any of the users which are in the group or your list collector does not have invalid email like missing @ or having illegal; characters like /


Raghav
MVP 2023

Ankur Bawiskar
Tera Patron
Tera Patron

@nandini29 

variable "select_list_of_users_to_send_emails" is of what type?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader