Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This server-side class serves provides methods for interaction with the email objects in email notification scripts. In addition to these methods, use the email global object available in the notification scripts.

addAddress(address, displayName)


This Use this method populates to populate the To field of the Email (sys_email) table record with the address specified.

Parameter(s):

NameTypeMandatoryDefault value
addressStringYN
displayNameString or NullNNULLnull

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titleaddAddress()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.addAddress(current.caller.email, current.caller.display_name);
})(current, template, email, event);

addAddressBcc(address, displayName)


This Use this method populates to populate the Blind Carbon Copy carbon copy (BCC) field of the Email (sys_email) table record with the address specified.

Parameter(s):

NameTypeMandatoryDefault value
addressStringYN
displayNameString or NullNNULLnull

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titleaddAddressBcc()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  if (+event.param_2 > 1000) {
    email.addAddressBcc(
      current.assigned_user.manager.email,
      current.assigned_user.manager.display_name
    );
  }
})(current, template, email, event);

addAddressCc(address, displayName)


This method populates the Carbon Copy copy (CC) field of the Email (sys_email) table record with the address specified.

Parameter(s):

NameTypeMandatoryDefault value
addressStringYN
displayNameString or NullNNULLnull

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titleaddAddressCc()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {  
  email.addAddressCc(
      current.assigned_user.manager.email,
      current.assigned_user.manager.display_name
  ); })(current, template, email, event);

getAddresses()


Use this method to get the recipient addresses.

Return:

TypeDescription
Array of StringsAn This method returns an array of strings that contains contain the recipient addresses.

Example:

Code Block
languagejs
themeEclipse
titlegetAddresses()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getAddresses();
})(current, template, email, event);

getAddressesBcc()


This method returns a list of recipients' recipient addresses stated in the BCC field.

Return:

TypeDescription
Array of StringsAn This method returns an array of strings containing that contain the recipient addresses from the BCC field.

Example:

Code Block
languagejs
themeEclipse
titlegetAddressesBcc()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getAddressesBcc();
})(current, template, email, event);

getAddressesCc()


This method returns the recipients' addresses stated in the CC field.

Return:

TypeDescription
Arrays of StringsAn This method returns an array of strings containing that contain addresses stated in the CC field.

Example:

Code Block
languagejs
themeEclipse
titlegetAddressesCc()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getAddressesCc();
})(current, template, email, event);

getBody()


This method gets the message body.

Return:

TypeDescription
StringThe This method returns the message body.

Example:

Code Block
languagejs
themeEclipse
titlegetBody()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getBody();
})(current, template, email, event);

getFrom()


This method returns a sender's address.

Return:

TypeDescription
StringA string containing This method returns the address of a sender.

Example:

Code Block
languagejs
themeEclipse
titlegetForm()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getFrom();
})(current, template, email, event);

getReplyTo()


This method returns the address set in the replyTo Reply to field.

Return:

TypeDescription
StringA string containing This method returns an address specified for a reply.

Example:

Code Block
languagejs
themeEclipse
titlegetReplyTo()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getReplyTo();
})(current, template, email, event);

getSubject()


This method returns the subject of a message.

Return:

TypeDescription
StringA string containing This method returns the message subject line.

Example:

Code Block
languagejs
themeEclipse
titlegetSubject()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.getSubject();
})(current, template, email, event);

setBody(bodyText)


This method sets the body of a message in the Body (Plain Texttext) field.

Parameter(s):

NameTypeMandatoryDefault value
bodyTextStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlesetBody()
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.setBody(`Additional comments:
${current.sys_updated_by.display_name}: "${current.additional_comments}"`
  );
})(current, template, email, event);

setFrom(address)


Use this method to change the From field value of an outgoing email. By default, the outgoing email email From field  field contains the address taken from the the From field  field of the default email account. Use the setFrom(address) method to change the From field value of an outgoing email.

It is impossible to change the email account for the outgoing email with this method. To change the default email account, change the value of the system property default.email.account.send.

The parameter value of the argument must be valid for must match the regular expression set specified in the   email.validation.reg_exp property.

Regardless of the value in the Form field of an outgoing email, the system conducts the sending authorization with the data set in the default email account.

Parameter(s):

NameTypeMandatoryDefault value
addressStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlesetFrom()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.setFrom('test@example.com');
})(current, template, email, event);


setReplyTo(address)


This method sets the replyTo Reply to address. The parameter value of the parameter sent must be valid for must match the regular expression , set specified in the email.validation.reg_exp property.

Parameter(s):

NameTypeMandatoryDefault value
addressStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlesetReplyTo()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.setReplyTo('test@example.com');
})(current, template, email, event);

setSubject(subject)


Use this method to set the subject of an email.

Parameter(s):

NameTypeMandatoryDefault value
subjectStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlesetSubject()
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current, 
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {
  email.setSubject('Additional comments have been added');
})(current, template, email, event);


Table of Contents
absoluteUrltrue
classfixedPosition