Unable to access CC email addresses in Flow Designer (Inbound Email Trigger)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi all,
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.
How can we correctly retrieve CC email addresses in Flow Designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @pot,
Maybe you can try this script; I had this in my PDI for some kind of similar use case. Hope this will work!!!
Let me know if it does!!!!!😀
var cc = fd_data.email.copied;
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(",");
If you find my answer useful, please mark it as Helpful and Correct. ‌‌😊
Regards,
Soham Tipnis
ServiceNow Developer || Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @SohamTipnis , no it thrown error . Error encountered while processing script for c1i.watch_list_sysids.__result: Unsupported reference: email (from fd_data.email.copied)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
@pot, have you tried to use?
gs.info(JSON.stringify(fd_data));
