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

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?

3 REPLIES 3

Tanushree Maiti
Tera Sage

Hi @pot 

 

Update script in your Action tab of inbound email in your flow.

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/script-to-add-cc-d-users-to-watch-...

 

https://www.servicenow.com/community/hrsd-forum/adding-users-sys-to-watchlist-on-inbound-action/m-p/...

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/inbound-action-to-populate-watcher...

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

Ankur Bawiskar
Tera Patron

@pot 

share your script here

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

What I am trying to achieve:

  • Parse all CC email addresses from the inbound email.

  • For each email:

    • If it matches an existing Contact → add the Contact to the Watch List.

    • If no match → still include the email in the Watch List.

  • Ensure multiple email addresses are properly appended (not overwritten).

Challenges:

  • Flow Designer seems to overwrite the Watch List when updating inside a loop.

  • Handling multiple values (comma-separated emails) is not working as expected.

  • Not sure what is the best approach to handle this without breaking OOTB behavior.

 

I have created custom action : 

(function execute(inputs, outputs) {

    var emailStr = inputs.email_string + "";  

    var emails = [];

    if (emailStr && emailStr != "null" && emailStr != "undefined") {

        emails = emailStr.split(",");

        for (var i = 0; i < emails.length; i++) {
            emails[i] = emails[i].trim();
        }
    }

    outputs.email_array = emails;

})(inputs, outputs);