Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Irina Oleynik
synergy-components
Commits
3b8517b1
Commit
3b8517b1
authored
Jan 24, 2022
by
Irina Oleynik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Отправка почтового сообщения
parent
1ea188bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
interpreter/event.blocking.interpreter.notification.supplier
interpreter/event.blocking.interpreter.notification.supplier
+57
-0
No files found.
interpreter/event.blocking.interpreter.notification.supplier
0 → 100644
View file @
3b8517b1
var result = true;
var message = "ok";
try {
let THEME_CMP_ID = 'itsm_form_settings_external_provider_get_incident_theme';
let SUBJECT_CMP_ID = 'itsm_form_settings_external_provider_get_incident_text';
let SETTINGS = API.httpGetMethod('rest/api/registry/data_ext?registryCode=itsm_registry_settings&fields=' + THEME_CMP_ID + '&fields=' + SUBJECT_CMP_ID);
if(SETTINGS.recordsCount == 0) throw new Error('Не найдены настройки');
let mailTheme = SETTINGS.result[0].fieldValue[THEME_CMP_ID];
let mailSubject = SETTINGS.result[0].fieldValue[SUBJECT_CMP_ID];
if(!mailTheme && !mailSubject) throw new Error('Не найдены настройки для формирования сообщения');
let currentFormData = API.getFormData(dataUUID);
let supplier_email = UTILS.getValue(currentFormData, 'itsm_form_incident_supplier_email');
UTILS.getParams(mailTheme).forEach(function(id) {
mailTheme = mailTheme.replace('${'+id+'}', UTILS.getValue(currentFormData, id).value || '');
});
UTILS.getParams(mailSubject).forEach(function(id) {
mailSubject = mailSubject.replace('${'+id+'}', UTILS.getValue(currentFormData, id).value || '');
});
// отправка письма
if(supplier_email && supplier_email.value && supplier_email.value != '') {
log.info('|||||||||| SUPPLIER EMAIL: ' + supplier_email.value);
log.info('|||||||||| THEME: ' + mailTheme);
log.info('|||||||||| SUBJECT: ' + mailSubject);
let sendResult = API.sendNotification({
header: mailTheme,
message: mailSubject,
emails: [supplier_email.value]
});
if(sendResult == 200) {
log.info('Уведомление успешно отправлено');
message = 'Уведомление успешно отправлено';
} else {
throw new Error('Произошла ошибка отправки уведомления');
}
} else {
throw new Error('Не найден email получателя');
}
} catch (err) {
log.error(err.message);
message = err.message;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment