Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Where to provide email.setFrom() when using scripted scheduled job?

Rajini2
Mega Sage

I have a scripted schedule job where reports are sent to users dynamically. Now I need to set "From" in those emails.

 

Where do I provide that?

1 ACCEPTED SOLUTION

Rajini2
Mega Sage

OK I figured that myself.

 

1. Created a email script "FromMajorIncident"

 

 

email.setFrom("Major Incident Management <MajorIncidentManagement@test.com>");

 

 

2. Included that email script in my scheduled job script as

 

 

var scheduled_report = new GlideRecord('sysauto_report');
scheduled_report.report_body = "bla bla bla<br/>${mail_script:FromMajorIncident}";

var answer = scheduled_report.insert();

 

 

 

It worked.

View solution in original post

1 REPLY 1

Rajini2
Mega Sage

OK I figured that myself.

 

1. Created a email script "FromMajorIncident"

 

 

email.setFrom("Major Incident Management <MajorIncidentManagement@test.com>");

 

 

2. Included that email script in my scheduled job script as

 

 

var scheduled_report = new GlideRecord('sysauto_report');
scheduled_report.report_body = "bla bla bla<br/>${mail_script:FromMajorIncident}";

var answer = scheduled_report.insert();

 

 

 

It worked.