how to apply forwarding in email

Shilpi Sharma2
Tera Contributor

HI All,

i have two prod instance 

1.old Prod instance

2. New Instance Prod

Now after some days my old prod instance is going to shut and my requirement is that i want to apply forwarding to old prod instance so that wherever any user created incident using old prod instance Email, Email will get forwarded To new prod instance Email. Please help.

2 REPLIES 2

Aniket Sawant
Mega Expert

Hi,

 

The easiest way is to create a business rule, which makes a copy of all received emails, and then creates a new mail in the outbox sending it to the other instance.

 

To create an email directly in the outbox do this:

 

 

 

var mail = new GlideRecord("sys_email");

 

mail.initialize();

 

mail.mailbox.setDisplayValue("Outbox");

 

mail.recipients = ("otherinstance@service-now.com");

 

mail.subject = ("Fw: " + current.subject);

 

mail.body = (current.body);

 

mail.type = "send-ready";

 

mail.content_type = "multipart/mixed";

 

mail.insert();

 

 

 

Regarding the processing of an email (target, header, etc) this is not done via business rules, so you can't access that part of the code.

Please mark correct or helpful based on the impact.

Regards,

Aniket Sawant.