{"id":294540,"date":"2019-09-11T09:00:20","date_gmt":"2019-09-11T09:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=294540"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=294540","title":{"rendered":"\u041a\u0430\u043a \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432 \u0411\u0438\u0442\u0440\u0438\u043a\u044124"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u044b\u0435 CRM-\u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0411\u0438\u0442\u0440\u0438\u043a\u044124. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0438\u0445 \u0440\u0435\u0448\u0430\u043b\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fx\/-p\/sj\/fx-psjbms29rlcnbbytsumkgw0y.jpeg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0411\u0438\u0442\u0440\u0438\u043a\u044124 \u2013 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c CRM. \u0412 \u043d\u0435\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 (\u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440) \u0434\u043b\u044f \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u2013 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0433\u0434\u0435 \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 (\u0434\u0430\u043b\u0435\u0435 \u2013 \u0411\u041f).<\/p>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 2-3 \u0434\u043d\u044f \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041a\u0440\u0443\u043f\u043d\u044b\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0435\u0431\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u043d\u0433.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bc\/-9\/2z\/bc-92zo3_pb_lszqvilcyr8ifvc.png\"><\/p>\n<p>  <i>\u0411\u0438\u0442\u0440\u0438\u043a\u044124 \u043e \u0442\u043e\u043c, <a href=\"https:\/\/helpdesk.bitrix24.ru\/open\/7380841\/\">\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/a> \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/i> <\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0435\u0435 \u043e\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 ID. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0442\u043e\u043c \u0436\u0435 \u0411\u0438\u0442\u0440\u0438\u043a\u044124 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u0430\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u2013 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0430\u044e\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430, \u0438 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043d\u0435\u0441\u0442\u044b\u043a\u043e\u0432\u043a\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. <\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/h2>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 (\u0438\u043c\u044f), \u0430 \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0435\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0437 \u0431\u0430\u0437\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0438. \u0418\u043c\u0435\u043d\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0445 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d. \u0414\u0430 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u2013 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0443\u0436 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: <\/b><\/p>\n<p>  \u0412\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 b_bp_workflow_template. \u041e\u0442\u043a\u0440\u044b\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u0440\u0435\u0434\u0438 \u043f\u043e\u043b\u0435\u0439 \u043c\u044b \u0432\u0438\u0434\u0438\u043c SYSTEM_CODE: \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u043a\u043e\u0434\u0430 \u0435\u0441\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f id \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u2014 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 url \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4j\/x2\/re\/4jx2redv2qt5vecw6aulrikvvmc.png\"><\/p>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 id \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438 \u043a\u043e\u0434, \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044f \u0443 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434.<\/p>\n<pre><code class=\"php\">use Bitrix\\Main\\Loader; Loader::includeModule(\"bizproc\"); $BPloader = CBPWorkflowTemplateLoader::GetLoader();  \/\/ set template CODE field setTemplateCode ($BPloader, 'TEST', '94' );  function setTemplateCode($BPloader, $code, $tempalteId) {     if (isCodeExists($BPloader, $code)) {        die('\u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442');    }     if (!isCodeEmpty($BPloader, $tempalteId)) {        die('\u041a\u043e\u0434 \u0443\u0436\u0435 \u0437\u0430\u0434\u0430\u043d \u0443 \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430')    }     $BPloader-&gt;UpdateTemplate($tempalteId, ['SYSTEM_CODE' =&gt; $code]); }   \/\/ check if $code exists in DB function isCodeExists($BPloader, string $code) {     $dbRes =  $BPloader-&gt;GetTemplatesList(       $arOrder = ['ID' =&gt; 'DESC'],       $arFilter = ['CODE' =&gt; $code],       $arGroupBy = false,       $arNavStartParams = false,       $arSelectFields = ['ID']    );     if (intval($dbRes-&gt;SelectedRowsCount()) &gt; 0) {        return true;    }     return false; }  \/\/ check if the template code is not empty function isCodeEmpty($BPloader, $tempalteId) {     $dbRes =  $BPloader-&gt;GetTemplatesList(       $arOrder = ['ID' =&gt; 'DESC'],       $arFilter = ['CODE' =&gt; '', 'ID' =&gt; $tempalteId],       $arGroupBy = false,       $arNavStartParams = false,       $arSelectFields = ['ID']    );     if (intval($dbRes-&gt;SelectedRowsCount()) &gt; 0) {        return false;    }     return true; }      return true; } <\/code><\/pre>\n<p>  \u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0441\u043f\u0438\u0441\u043a\u0430\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k4\/z-\/qc\/k4z-qcs92cs5g7xcoiyf4dozfs0.png\"><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 (\u0430 \u043f\u043e\u0442\u043e\u043c \u0438 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d), \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439. <\/p>\n<p>  \u0411\u0438\u0442\u0440\u0438\u043a\u044124 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/0x\/ew\/1c\/0xew1cwrivumtl94pxwpfqvycoy.png\"><\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0442\u0430\u043a\u0430\u044f:<\/p>\n<ul>\n<li>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/li>\n<li>\u041f\u0438\u0448\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b<\/li>\n<li>\u041d\u0430 \u043d\u043e\u0432\u043e\u043c \u0441\u0442\u0435\u043d\u0434\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u0431\u044d\u043a\u0430\u043f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e<\/li>\n<\/ul>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0438\u0437 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0430: <a href=\"https:\/\/marketplace.1c-bitrix.ru\/solutions\/ws.migrations\/\">https:\/\/marketplace.1c-bitrix.ru\/solutions\/ws.migrations\/<\/a>.<\/p>\n<p>  \u0424\u0430\u0439\u043b\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <b>local\/migrations\/scenarios<br \/>  <\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dp\/pr\/g1\/dpprg1qs2z8qe_3i03xq87oo1xs.png\"><\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442. \u0412\u043d\u0443\u0442\u0440\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e files \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <b>local\/migrations\/scenarios\/files\/bp-94.bpt<\/b><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code class=\"php\">class ws_m_1565783124_approve_task extends \\WS\\Migrations\\ScriptScenario {<\/code><\/pre>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code class=\"php\">class ws_m_1565783124_approve_task extends \\WS\\Migrations\\ScriptScenario {    private $arBPFields = [        'DOCUMENT_TYPE' =&gt; [            'lists',            'BizprocDocument',            'iblock_'        ],        'AUTO_EXECUTE' =&gt; 0,        'NAME' =&gt; '\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447',        'CODE' =&gt; 'TEST',    ];<\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code class=\"php\">private function importBP($path) {    CModule::IncludeModule('bizproc');    CModule::IncludeModule('iblock');     \/\/Get iBlock id for which BP is created    $this-&gt;arBPFields['DOCUMENT_TYPE'][2] .= $this-&gt;getIblockId();     \/\/ Get BP id by the CODE    $result = \\CBPWorkflowTemplateLoader::GetList(        [],        [            'CODE'      =&gt; $this-&gt;arBPFields['CODE'],            'MODULE_ID' =&gt; 'lists'        ]    );       if ($arFields = $result-&gt;GetNext()) {        $id = $arFields['ID'];    } else {        $id = 0;    }     \/\/read file to a variable    $f = fopen($path, 'rb');    $datum = fread($f, filesize($path));    fclose($f);     \/\/Update BP if id&gt;0, otherwise add BP    \\CBPWorkflowTemplateLoader::ImportTemplate(        $id,        $this-&gt;arBPFields['DOCUMENT_TYPE'],        $this-&gt;arBPFields['AUTO_EXECUTE'],        $this-&gt;arBPFields['NAME'],        '',        $datum,        $this-&gt;arBPFields['CODE']    );     return $arFields['ID']; } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c ID \u0438\u043d\u0444\u043e\u0431\u043b\u043e\u043a\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c id \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0439\u0434\u0435\u043d \u2013 \u043c\u044b \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u2013 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c.<br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 id \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0430 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u2013 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e commit, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\/\u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u043d\u0430\u0448 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"php\">public function commit() {  $pathBPElement = __DIR__ . '\/files\/bp-94-approve-task.bpt'; $id = $this-&gt;importBP($pathBPElement); }<\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u044b \u0443\u0436\u0435 \u0443\u043c\u0435\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439.<\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0432 \u043d\u0430\u0448 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u2013 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tf\/m0\/8k\/tfm08kk36ju3xtaonop4vjpr3lo.png\"><\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0410\u0432\u0442\u043e\u0440\u0430. \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u0438 \u0431\u0443\u0434\u0443\u0442:<\/p>\n<ul>\n<li>\u0413\u0440\u0443\u043f\u043f\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 HR<\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0421\u0432\u0435\u0442\u043b\u0430\u043d\u0430 \u041a\u0443\u0437\u043d\u0435\u0446\u043e\u0432\u0430<\/li>\n<\/ul>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0431\u0430\u0437\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 PHP \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yi\/ug\/nx\/yiugnxm3nbaflnr1_syuq9_3ljm.png\"><\/p>\n<p>  \u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/w6\/wm\/wb\/w6wmwbgunucvakqyk_1skuvqwqa.png\"><\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 group_g15. \u0417\u0434\u0435\u0441\u044c 15 \u2013 \u044d\u0442\u043e ID \u0433\u0440\u0443\u043f\u043f\u044b HR.<br \/>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 user_579. \u0417\u0434\u0435\u0441\u044c 579 \u2013 \u044d\u0442\u043e ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<p>  \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435, \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u0435 \u043d\u0435\u0441\u0442\u044b\u043a\u043e\u0432\u043a\u0438.<\/p>\n<p>  \u0422.\u043e. \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0443 \u043f\u043e\u0441\u043b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 ID \u043d\u0430 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438, \u043a\u0443\u0434\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<p>  \u0413\u0440\u0443\u043f\u043f\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u2013 \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u0442\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0435, \u0433\u0434\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u043b\u043e\u0433\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u0433\u0440\u0443\u043f\u043f, \u043b\u0443\u0447\u0448\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0445. <\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<ul>\n<li>\u041a\u043e\u0434 \u0433\u0440\u0443\u043f\u043f\u044b \u2013 HR<\/li>\n<li>\u041b\u043e\u0433\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2013 svetlana.kuznetsova<\/li>\n<\/ul>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0438\u0448\u0435\u043c \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e \u043a\u043e\u0434\u0443 \u0438 \u043b\u043e\u0433\u0438\u043d\u0443 \u043e\u0442\u0434\u0430\u0434\u0443\u0442 \u043d\u0430\u043c id \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<ul>\n<li>getUserId($login)<\/li>\n<li>getGroupId($code);<\/li>\n<\/ul>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"php\">\/**   * Write action by apply scenario. Use method `setData` for save need rollback data   **\/  public function commit() {<\/code><\/pre>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"php\">$pathBPElement = __DIR__ . '\/files\/bp-94-approve-task.bpt'; $id = $this-&gt;importBP($pathBPElement);<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<pre><code class=\"php\">$arFieldsTemplate = \\CBPWorkflowTemplateLoader::GetList([], ['ID' =&gt; $id])-&gt;GetNext(); $template = $arFieldsTemplate[\"TEMPLATE\"];<\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code class=\"php\">$template[0]['Children'][0]['Properties'][\"MessageUserTo\"][0] = 'group_g' . $this-&gt;getGroupId('HR'); $template[0]['Children'][0]['Properties'][\"MessageUserTo\"][1] = 'user_' . $this-&gt;getUserId('svetlana.kuznetsova'); $arNewFields = [   \u201cTEMPLATE\u201d =&gt; $template,   \u201cVARIABLES\u201d =&gt; $arFieldsTemplate[\"VARIABLES\"] ]; $arNewFields[\"MODIFIER_USER\"] = new \\CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser);  \\CBPWorkflowTemplateLoader::Update($id, $arNewFields);  } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 importBP \u0441\u043e\u0437\u0434\u0430\u0435\u043c\/\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u043c ID \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d.<\/p>\n<h2>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433\u0438<\/h2>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b\u0438 \u043b\u0438\u0448\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438, \u0433\u0434\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f, \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438, \u043d\u0430 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0412 \u0446\u0435\u043b\u043e\u043c \u043c\u044b \u0432 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430\u043c\u0438 \u043f\u043e id:<\/p>\n<ul>\n<li>user_ (\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e)<\/li>\n<li>group_ (\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0433\u0440\u0443\u043f\u043f\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439)<\/li>\n<li>iblock_ (\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0438\u043d\u0444\u043e\u0431\u043b\u043e\u043a\u0443)<\/li>\n<li>SequentialWorkflowActivity (\u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430)<\/li>\n<li>PROPERTY_ (\u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u043f\u043e\u043b\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0441 \u043d\u0435\u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c)<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043e\u0442\u043b\u0430\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0433\u043b\u0430\u0434\u043a\u043e. <\/p>\n<p>  \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448 \u043e\u043f\u044b\u0442 \u0431\u044b\u043b \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u0435\u043d!<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  \/**  * Updates migration scenario actions  **\/ class ws_m_1565783124_approve_task extends \\WS\\Migrations\\ScriptScenario {      private $arBPFields = [         'DOCUMENT_TYPE' =&gt; [             'lists',             'BizprocDocument',             'iblock_'         ],         'AUTO_EXECUTE' =&gt; 0,         'NAME' =&gt; '\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447',         'CODE' =&gt; 'TEST',     ];      private $codeIBlock = 'APPROVE_TASK';      \/**      * Name of scenario      * @return string      **\/     public static function name()     {         return 'approve task process';     }      \/**      * Description of scenario      * @return string      **\/     public static function description()     {         return 'process to approve task and set task deadline  +14 days after approving';     }      \/**      * @return array First element is hash, second is owner name      *\/     public function version()     {         return ['13ebf9abe69204014459b80a7036b7a0', ''];     }      \/**      * Return IBlock ID      * @return int      *\/     private function getIblockId()     {         $result = CIBlock::GetList(             [],             [                 'TYPE'   =&gt; 'bitrix_processes',                 '=CODE'  =&gt; $this-&gt;codeIBlock             ],             false,             ['nTopCount' =&gt; 1]         );         if ($arIBlock = $result-&gt;Fetch()) {             return $arIBlock['ID'];         }                      return 0;     }      \/**      * Start import BP      * @param $path      * @return mixed      *\/     private function importBP($path)     {         CModule::IncludeModule('bizproc');         CModule::IncludeModule('iblock');          \/\/Get iBlock id for which BP is created         $this-&gt;arBPFields['DOCUMENT_TYPE'][2] .= $this-&gt;getIblockId();          \/\/ Get BP id by the CODE         $result = \\CBPWorkflowTemplateLoader::GetList(             [],             [                 'CODE'      =&gt; $this-&gt;arBPFields['CODE'],                 'MODULE_ID' =&gt; 'lists'             ]         );                  if ($arFields = $result-&gt;GetNext()) {             $id = $arFields['ID'];         } else {             $id = 0;         }          \/\/read file to a variable         $f = fopen($path, 'rb');         $datum = fread($f, filesize($path));         fclose($f);          \/\/Update BP if id&gt;0, otherwise add BP         \\CBPWorkflowTemplateLoader::ImportTemplate(             $id,             $this-&gt;arBPFields['DOCUMENT_TYPE'],             $this-&gt;arBPFields['AUTO_EXECUTE'],             $this-&gt;arBPFields['NAME'],             '',             $datum,             $this-&gt;arBPFields['CODE']         );          return $arFields['ID'];     }      \/**      * @param $login      * @return mixed      *\/     private function getUserId($login)     {         $rsUsers = Bitrix\\Main\\UserTable::getList([             \"select\" =&gt;['ID'],             \"filter\" =&gt; ['LOGIN' =&gt; $login],         ]);         $userFields = $rsUsers-&gt;fetch();          return $userFields['ID'];     }      \/**      * @param $code      * @return mixed      *\/     private function getGroupId($code)     {         $rsGroups = \\Bitrix\\Main\\GroupTable::getList(             [                 'filter' =&gt; ['STRING_ID'=&gt; 'HR'],                 'select' =&gt; ['ID']             ]);          $arFields = $rsGroups-&gt;fetch();                  return $arFields['ID'];     }      \/**      * Write action by apply scenario. Use method `setData` for save need rollback data      **\/     public function commit()     {         \/\/make BP import         $pathBPElement = _DIR_ . '\/files\/bp-94-approve-task.bpt';         $id = $this-&gt;importBP($pathBPElement);          \/\/get template data         $arFieldsTemplate = \\CBPWorkflowTemplateLoader::GetList([], ['ID' =&gt; $id])-&gt;GetNext();         $template = $arFieldsTemplate['TEMPLATE'];          \/\/replace id inside BP tempalte         $template[0]['Children'][0]['Properties']['MessageUserTo'][0] = 'group_g' . $this-&gt;getGroupId('HR');         $template[0]['Children'][0]['Properties']['MessageUserTo'][1] = 'user_' . $this-&gt;getUserId('svetlana.kuznetsova');         $arNewFields = [             'TEMPLATE' =&gt; $template,             'VARIABLES' =&gt; $arFieldsTemplate['VARIABLES']         ];         $arNewFields['MODIFIER_USER'] = new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser);          \\CBPWorkflowTemplateLoader::Update($id, $arNewFields);     }      \/**      * Write action by rollback scenario. Use method `getData` for getting commit saved data      **\/     public function rollback()     {         $pathBPElement = _DIR_ . '\/files\/bp-wt-old.bpt';         $id = $this-&gt;importBP($pathBPElement);          $arFieldsTemplate = \\CBPWorkflowTemplateLoader::GetList([], ['ID' =&gt; $id])-&gt;GetNext();         $template = $arFieldsTemplate['TEMPLATE'];          $arNewFields = [             'TEMPLATE' =&gt; $template,             'VARIABLES' =&gt; $arFieldsTemplate['VARIABLES']         ];         $arNewFields['MODIFIER_USER'] = new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser);         \\CBPWorkflowTemplateLoader::Update($id, $arNewFields);     } }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/466823\/\"> https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/466823\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u044b\u0435 CRM-\u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0411\u0438\u0442\u0440\u0438\u043a\u044124. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0438\u0445 \u0440\u0435\u0448\u0430\u043b\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fx\/-p\/sj\/fx-psjbms29rlcnbbytsumkgw0y.jpeg\">  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-294540","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=294540"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/294540\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}