Documentation

bizproc.workflow.template.add

The method adds a workflow template. Requires administrator access permissions.

Parameters

Parameter Description Available from version
DOCUMENT_TYPE Document type - array of 3 elements:
  • module ID
  • entity (class)
  • document type directly
Examples:
['crm', 'CCrmDocumentLead', 'LEAD']
['lists', 'BizprocDocument', 'iblock_22']
['disk', 'Bitrix\Disk\BizProcDocument', 'STORAGE_490']
['tasks', 'Bitrix\Tasks\Integration\Bizproc\Document\Task', 'TASK_PROJECT_13']
NAME Template name
DESCRIPTION Template description.
TEMPLATE_DATA The *.bpt fil content to be passed (standard for REST).
AUTO_EXECUTE Autoexecute flags. Possible values: 0, 1 (create), 2 (modify) , 3 (create + modify)

Example

function addTemplate()
{
   BX24.callMethod(
      'bizproc.workflow.template.add',
      {
         DOCUMENT_TYPE: ['crm', 'CCrmDocumentLead', 'LEAD'],
         NAME: 'App template',
         DESCRIPTION: 'Template was generated by rest application.',
         AUTO_EXECUTE: 1,
         TEMPLATE_DATA: document.getElementById('tpl_file')
      },
      function(result)
      {
         if(result.error())
            alert("Error: " + result.error());
         console.log(result);
      }
   );
}


© «Bitrix24», 2001-2022
Up