Commit e478ed9c authored by Irina Oleynik's avatar Irina Oleynik

Добавление файла на форме

parent dacb54f5
var result = true;
var message = "ok";
try {
let fileName = "printFormFile.pdf";
let PDFFile = API.getPrintFilePDF(dataUUID);
let tmpFile = API.startUpload();
let uploadPartResult = API.uploadPart(tmpFile.file, PDFFile);
let asfFileAddResult = API.addFileInForm(dataUUID, fileName, tmpFile.file);
if(asfFileAddResult && asfFileAddResult.hasOwnProperty('fileId')) {
let resultSaveFile = API.appendTable(dataUUID, 'attachments', [{
id: 'file',
type: 'file',
value: fileName,
key: asfFileAddResult.fileId
}]);
if(resultSaveFile.errorCode != '0') throw new Error('Ошибка сохранения файла на форме appendTable');
message = 'Файл успешно добавлен';
} else {
throw new Error('Ошибка загрузки файла addFileInForm');
}
} catch (err) {
log.error(err.message);
message = err.message;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment