You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 4 Next »
This server-side class serves for the implementation of the email objects for applications; in addition to these methods, use the email global object available in the notification scripts.
addAddress(address, displayName)
This method populates the To field of the Email (sys_email) table record with the address specified.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
address | String | Y | N |
displayName | String or Null | N | 'NULL' |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(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 method populates the Blind Carbon Copy (BCC) field of the Email (sys_email) table record with the address specified.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
address | String | Y | N |
displayName | String or Null | N | 'NULL' |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(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 (CC) field of the Email (sys_email) table record with the address specified.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
address | String | Y | N |
displayName | String or Null | N | 'NULL' |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.addAddressCc('john.doe@example.com', 'John Doe'); })(current, template, email, event);
getAddresses()
This method gets the recipients' addresses.
Return:
Type | Description |
---|---|
String | A string containing the recipient's addresses. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.getAddresses(); })(current, template, email, event);
getAddressesBcc()
This method gets the recipients' BCC addresses.
Return:
Type | Description |
---|---|
String | A string containing the recipient's BCC addresses. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.getAddressesBcc(); })(current, template, email, event);
getAddressesCc()
This method gets the recipients' CC addresses.
Return:
Type | Description |
---|---|
String | A string containing the recipient's CC addresses. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.getAddressesCc(); })(current, template, email, event);
getBody()
This method gets the message body.
Return:
Type | Description |
---|---|
String | The message body. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.getBody(); })(current, template, email, event);
getFrom()
This method gets the sender's address.
Return:
Type | Description |
---|---|
String | A string containing the sender's address. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.getFrom(); })(current, template, email, event);
getReplyTo()
This method gets the replyTo address.
Return:
Type | Description |
---|---|
String | A string containing the replyTo address. |
Example:
(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:
Type | Description |
---|---|
String | A string containing the message subject line. |
Example:
(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.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
bodyText | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(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)
By default, the outgoing email From field contains the address taken from the From field of the linked email account. Use the setFrom(address) method to change the field value.
The value of the argument must be valid for the regular expression set in the email.validation.reg_exp property.
While possessing the email, the system conducts the sending authorization with the data set in the email account, regardless of the value in the Form field.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
address | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(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 address. The argument value of the method must be valid for the regular expression, set in the email.validation.reg_exp property.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
address | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.setReplyTo('test@example.com'); })(current, template, email, event);
setSubject(subject)
This method sets the subject of an email.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
subject | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
(function runNotificationScript( /* SimpleRecord */ current, /* SimpleTemplatePrinter */ template, /* SimpleEmailOutbound */ email, /* SimpleRecord */ event ) { email.setSubject('Additional comments have been added'); email.setBody(`Additional comments: ${current.sys_updated_by.display_name}: "${current.additional_comments}"` ); })(current, template, email, event);
- No labels