Skip to content

Instantly share code, notes, and snippets.

@aviriel
Created October 26, 2015 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aviriel/fdf5b47539cb87e2ea27 to your computer and use it in GitHub Desktop.
Save aviriel/fdf5b47539cb87e2ea27 to your computer and use it in GitHub Desktop.
// Создание документа
var node = list.createNode(null, "alvexdt:agreement");
// Генерация номера нового документа
node.properties["alvexdt:id"] = alvexRegistriesService.suggestNextNumber(list);
list.properties["alvexdr:inc"] = list.properties["alvexdr:inc"]+1;
list.properties["alvexdr:dayInc"] = list.properties["alvexdr:dayInc"]+1;
list.properties["alvexdr:monthInc"] = list.properties["alvexdr:monthInc"]+1;
list.properties["alvexdr:yearInc"] = list.properties["alvexdr:yearInc"]+1;
list.properties["alvexdr:quarterInc"] = list.properties["alvexdr:quarterInc"]+1;
list.save();
// Подстановка текущей даты в поле alvexdt:registerDate
var currentDate = new Date();
node.properties["alvexdt:registerDate"] = currentDate;
// Подстановка в поле "Контрагент" значения из поля на форме задачи, к которому подключен справочник
node.properties["alvexdt:contractor"] = execution.getVariableLocal('atw20_contractor');
// Заполнение поля "Подписан"
node.properties["alvexdt:ifsigned"] = false;
// Сохранение свойств
node.save();
// Выбор подписанта из оргструктуры по роли "CEO" и его подстановка в поле "Подписант"
units = orgchart.getBranches();
unit = units[0];
role = unit.getRole("CEO");
users = role.getAssignees();
user = users[0];
userName = user.getUserName();
alfUser = people.getPerson(userName);
node.createAssociation(alfUser,"alvexdt:signatory");
// Перенос файлов из пакета документов процесса в "Файлы" документа реестра
for each(document in bpm_package.children)
node.createAssociation(document,"alvexdt:files");
// Сохранение nodeRef документа в переменные процесса, вдруг пригодится
execution.setVariable('nodeRef', node.nodeRef.toString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment