Versions Compared

Key

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

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
Тип
MandatoryDefault Value
ОбязательныйЗначение по умолчанию
addressString
Y
Да
N
Нет
displayNameString
or Null
N
Нет
'NULL'
null

Возвращаемое значениеReturn:

Type
Description
Описание
Void
This 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 method populates the Blind Carbon Copy (BCC) field of the Email (Используйте метод для добавления указанного электронного адреса в поле Скрытая копия записи таблицы Электронная почта(sys_email) table record with the address specified.

Parameter(s)Параметры:

Name
Название
Type
Тип
MandatoryDefault Value
ОбязательныйЗначение по умолчанию
addressString
Y
Да
N
Нет
displayNameString
or Null
N
Нет
'NULL'
null

Возвращаемое значениеReturn:

Type
Тип
Description
Описание
Void
This 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 (CC) field of the Email (Используйте этот метод, чтобы добавить указанный электронный адрес в поле Копия записи таблицы Электронная почта(sys_email) table record with the address specified.

Parameter(s)Параметры:

Name
Название
Type
Тип
MandatoryDefault Value
ОбязательныйЗначение по умолчанию
addressString
Y
Да
N
Нет
displayNameString
or Null
N
Нет
'NULL'
null

Возвращаемое значениеReturn:

Type
Тип
Description
Описание
Void
This 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('john.doe@example.com', 'John Doe'
      current.assigned_user.manager.email,
      current.assigned_user.manager.display_name 
  );
})(current, template, email, event);

getAddresses()

This method gets the recipients' addresses.

Return:

TypeDescriptionStringA string containing the recipient's addresses.

Используйте этот метод, чтобы получить адреса получателей.

Возвращаемое значение:

ТипОписание
Array of StringsМетод возвращает массив строк с электронными адресами получателей.

Пример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 gets the recipients' BCC addresses.

Return:

TypeDescriptionStringA string containing the recipient's BCC addresses.

Используйте этот метод, чтобы получить адреса получателей, указанных в Скрытой копии письма.

Возвращаемое значение:

ТипОписание
Array of StringsМетод возвращает массив строк с адресами получателей Скрытой копии.

Пример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 gets the recipients' CC addresses.

Return:

TypeDescriptionStringA string containing the recipient's CC addresses.

Используйте этот метод, чтобы получить адреса получателей, указанных в Копии письма.

Возвращаемое значение:

ТипОписание
Array of StringsМетод возвращает массив строк с адресами получателей, указанных в Копии письма.

Пример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:

TypeDescriptionStringThe message body.

Используйте этот метод для получения текста письма.

Возвращаемое значение:

ТипОписание
StringМетод возвращает текст письма.

Пример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 gets the sender's address.

Return:

TypeDescriptionStringA string containing the sender's address.

Используйте этот метод, чтобы получить адрес отправителя.

Возвращаемое значение:

ТипОписание
StringМетод возвращает адрес отправителя.

Пример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 gets the replyTo address.

Return:

TypeDescriptionStringA string containing the replyTo address.

Используйте этот метод, чтобы получить адрес, указанный в поле Ответ.

Возвращаемое значение:

ТипОписание
StringМетод возвращает адрес, указанный для ответа.

Пример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:

TypeDescriptionStringA string containing the message subject line.

Используйте этот метод, чтобы получить тему письма.

Возвращаемое значение:

ТипОписание
StringМетод возвращает тему письма.

Пример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.

Parameter(s):


Используйте этот метод, чтобы задать текст письма в поле Обычный текст.

Параметры:

НазваниеТипОбязательныйЗначение по умолчанию
NameTypeMandatoryDefault Value
bodyTextString
Y
Да
N
Нет

ReturnВозвращаемое значение:

Type
Тип
Description
Описание
Void
This method does not return a value
Метод не возвращает значение.

ExampleПример:

Code Block
languagejs
themeEclipse
titlesetBody()
linenumberstrue
(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 default email account. Use the setFrom(address) method to change the From field value of an outgoing email.


Используйте метод, чтобы изменить значение адреса отправителя в поле От кого исходящего письма. По умолчанию значение поля От кого исходящего письма берётся из поля От кого дефолтного почтового аккаунта.

Данный метод не позволяет изменить почтовый аккаунт для исходящего письма. Для изменения почтового аккаунта по умолчанию измените значение системного свойства defaultIt 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 value of the argument must be valid for the regular expression set 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
addressString
Y
Да
N
Нет

ReturnВозвращаемое значение:

Type
Тип
Description
Описание
Void
This 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 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
Тип
MandatoryDefault Value
ОбязательныйЗначение по умолчанию
addressString
Y
Да
N
Нет

ReturnВозвращаемое значение:

Type
Тип
Description
Описание
Void
This 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)

This method sets the subject of an email.

Parameter(s):


Используйте этот метод, чтобы установить тему письма.

Параметры:

НазваниеТипОбязательныйЗначение по умолчанию
NameTypeMandatoryDefault Value
subjectString
Y
Да
N
Нет

ReturnВозвращаемое значение:

Type
Тип
Description
Описание
Void
This 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');
  email.setBody(`Additional comments:
${current.sys_updated_by.display_name}: "${current.additional_comments}"`
  новые комментарии');
})(current, template, email, event);


Table of Contents
absoluteUrltrue
classfixedPosition