Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business rule to copy "To" to Bcc for particular user

CV1
Tera Contributor

Hi All,

 

Have a requirement to copy values from TO into Bcc for users whos email end with  say "@a.com'

looking for script for a onbefore business rule to active this.

TIZ

1 ACCEPTED SOLUTION

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @CV1 ,

 

You can use the below script to make it work.

 

var email = current.recipients;
	var checkmail = email.slice(email.indexOf('@'));
	if(checkmail == '@a.com'){
		current.blind_copied = current.recipients;
	}

 

 

If this response clears up your doubt, kindly flag it as both helpful and correct.

Thanks,

Alka

View solution in original post

3 REPLIES 3

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @CV1 ,

 

You can use the below script to make it work.

 

var email = current.recipients;
	var checkmail = email.slice(email.indexOf('@'));
	if(checkmail == '@a.com'){
		current.blind_copied = current.recipients;
	}

 

 

If this response clears up your doubt, kindly flag it as both helpful and correct.

Thanks,

Alka

Hi alka,

Thank you for your the solution.

I want to copy both recipients and cc to bcc and then clear "direct"  and "copied" values like

// create variables for use from current record
var to = current.direct;
var cc = current.copied;
var bcc += to + ',' + cc;

// update the current record
current.direct = '';
current.copied = '';
current.blind_copied = bcc;

 

So Bcc need to store TO(direct) cc(Copied) values then clear To and CC values.

TIA

Hello @CV1 ,

If the solution that I have provided fulfilled your original requirement then please mark it as a Solution.

Thanks,

Alka