How can i pass user email address from incident form to MIM communication task recipient?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2025 01:39 AM
Hi Team,
I have a list field on the Incident form where multiple users can be selected. My requirement is: when multiple users are selected in this field, their email addresses should be passed to the "To" field of the MIM Workbench Communication Task as recipients.
Could you please guide me on how this can be implemented?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2025 04:03 AM
Refer below for sample code, customize according to your business requirements
var res='';
var mim_recipients=[];
var IncGr = new GlideRecord(sourceTable);
IncGr.addQuery("sys_id", commPlanSourceId);
IncGr.query();
while (IncGr.next()) {
//<Add your business logic to retrieve list of users in Incident table and do a glide record query with while loop>
{
res += ',' + gr.<user_field>;
}
res=res.replace(",", "");
mim_recipients=res.split(',');
var unique_recipients_list = new global.ArrayUtil().unique(mim_recipients);
var obj = {'internal' : unique_recipients_list};
return obj;
}})();
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2025 12:14 AM
Its not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2025 06:36 AM
Can you share the code you have created and more details regarding steps you followed ?
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2025 08:02 AM
Hi @Bhuvan
Please find the script below:
function email() {
var customer = current.u_affected_customer.toString().split(',');
var emailList = [];
for (var i = 0; i < customer.length; i++) {
var company = new GlideRecord('core_company');
company.addQuery('sys_id', customer[i]);
company.query();
while (company.next()) {
if (company.email) {
emailList.push(company.email);
}
}
}
var uniqueEmail = new global.ArrayUtil().unique(emailList);
var obj = {'internal': uniqueEmail};
return obj;
}
email();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2025 02:43 AM
Hi Ankit,
If you are trying to pass email IDs from Incident table [source table] to MIM Work bench Communication Task table, not sure why you are gliding records on company table.
If possible can you share screenshots of your configuration and explain in detail what you are trying to achieve so as to refine the code ?
Thanks,
Bhuvan