How to populate multiple CC email addresses into Watch List from inbound email using flow designer?

pot
Tera Contributor

Hi all,

I am working on an inbound email use case where I need to populate the Watch List field on a Case record using the CC email addresses from the inbound email.

Current behavior:

  • If there is only one email address in CC, mapping it directly to the Watch List works fine.

  • However, when there are multiple email addresses in CC, the Watch List is not getting populated. Any suggestions?

8 REPLIES 8

hi @pot ,

 

if this solution is helpful please close the threat and accept the solution .

 

Thanks,

Rithika.ch

Hi @Ankur Bawiskar , any update ?

@pot 

why not return the sys_ids as string from the custom flow action by checking the query logic etc

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi @Ankur Bawiskar  , yes i tried .But its not working .

I am trying to fetch **CC email addresses** from an **Inbound Email trigger in Flow Designer** and populate the **Watch List**.

I created a **Flow Variable (watchlist_sysids)** and used a **Set Flow Variables (script)** step with the below code:

```javascript
var cc = fd_data.trigger.cc;
if (!cc) return "";

var emails = cc.split(",");
var result = [];

for (var i = 0; i < emails.length; i++) {
var email = emails[i].trim();
if (!email) continue;

var gr = new GlideRecord('sys_user');
gr.addQuery('email', email);
gr.query();

if (gr.next()) {
result.push(gr.sys_id.toString());
}
}

return result.join(",");
```

### Error faced:

```
Cannot read property "cc" from null
```

I also tried using `trigger.email.cc` and `copied`, but still facing issues.