Add group member in CC using mail script while autopopulating email

UjwalaBedarkar
Tera Expert

Hi,

I have used email template in order to auto-populate the content once the user clicks on the link. But I want to add group members in cc. is it possible using email template? (note: I am not using email client template)

 

UjwalaBedarkar_0-1715963613430.png

UjwalaBedarkar_1-1715963637374.png

as the first line in email template appears as link and any text after that gets autopopulated in reply email. is it any possible way to add email scipt which will add cc in reply email?

 

2 REPLIES 2

Gangadhar Ravi
Giga Sage
Giga Sage

Please post your current email script

swathisarang98
Giga Sage
Giga Sage

Hi @UjwalaBedarkar ,

 

You can write a email script and call that script in the message html part,

 

email_script:

swathisarang98_0-1715979094300.png

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    var grp = new GlideRecord('sys_user_grmember');
    grp.addQuery('group', current.assignment_group);
    grp.query();
    while (grp.next()) {
        email.addAddress("cc",grp.user.email.toString(),grp.user.name.toString());
		//gs.info('email '+grp.user.email);
    }

})(current, template, email, email_action, event);

 

Email Template:

swathisarang98_1-1715979452237.png

 

Result:

swathisarang98_2-1715979489405.png

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang