to add cc users to watchlist

Poorva Bhawsar2
Tera Contributor

When end user replies to Servicenow notification the CC list should be added to Watch List in the Incident form.

I have tried a script but it is adding CC as well as To users in the watchlist. I want to add only CC list to the watchlist not the sender.

 

gs.include('validators');

 if (current.getTableName() == "incident") {

    current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;

    var wList = current.watch_list;  // Existing users in watchlist if any

    var rarray = email.copied.split(",");  //Recipient in CC

    var instanceEmail = gs.getProperty('glide.email.user'); //Email ID of your instance

 

    for (var i = 0; i < rarray.length; i++) {

        var recipient = rarray[i];

        wList = (wList + "," + recipient);

    }

    current.watch_list = wList;

    current.update();

}

2 REPLIES 2

Kalaiarasan Pus
Giga Sage
email.copiedContains a comma-separated list of email addresses in the Cc: box.

You seem to be using the right object property. Have tried logging this property to see if the right values are present?

Poorva Bhawsar2
Tera Contributor

I am using email.copied itself but in watchlist it is showing me cc list as well as sender name. I only want cc list not sender name.