Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Unable to access CC email addresses in Flow Designer (Inbound Email Trigger)

pot
Tera Contributor

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?

4 REPLIES 4

Tanushree Maiti
Tera Sage

Hi @pot 

 

Check this post . if it helps you.

https://www.servicenow.com/community/developer-forum/cannot-get-the-cc-email-from-the-inbound-email/....

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

SohamTipnis
Mega Sage

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

pot
Tera Contributor

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)

@pot, have you tried to use?

gs.info(JSON.stringify(fd_data));