Documentation

bizproc.workflow.start

bizproc.workflow.start launches a worfklow

Use the method [link=2057263]lists_element_add[/link] to run a workflow in Feed. IBLOCK_TYPE_ID in this case will be bitrix_processes.

Method Description
TEMPLATE_ID Workflow template ID
DOCUMENT_ID Workflow element ID
PARAMETERS Workflow parameters ID (if the template has parameters)

Example

function startWf(leadId, tplId, cb)
{
   if (!leadId)
   {
      alert('Lead not selected');
      return;
   }

   var params = {
      TEMPLATE_ID: tplId,
      DOCUMENT_ID: ['crm', 'CCrmDocumentLead', leadId],
      PARAMETERS: null
   };

   BX24.callMethod(
      'bizproc.workflow.start',
      params,
      function(result)
      {
         if(result.error())
            alert("Error: " + result.error());
         else if (cb)
            cb();
      }
   );
}

Examples for parameter DOCUMENT_ID:

['crm', 'CCrmDocumentLead', 'LEAD_777'] - Lead
['crm', 'CCrmDocumentCompany', 'COMPANY_777'] - Company
['crm', 'CCrmDocumentContact', 'CONTACT_777'] - Contact
['crm', 'CCrmDocumentDeal', 'DEAL_777'] - Deal
['lists', 'BizprocDocument', '777'] - Drive file 
['disk', 'Bitrix\Disk\BizProcDocument', '777'] - Process in Feed
['tasks', 'Bitrix\Tasks\Integration\Bizproc\Document\Task', '777'] - List

Example of DOCUMENT_ID for SPA:

DOCUMENT_ID = ['crm', 'Bitrix\Crm\Integration\BizProc\Document\Dynamic', 'DYNAMIC_147_1']

where 147 - is SPA's ID, 1 - element ID.


Example for entering to DOCUMENT_ID for new invoices:

Bitrix\Crm\Integration\BizProc\Document\SmartInvoice

SMART_INVOICE_<element ID> 

Use user identifier record as user_ID to pass "Bind to user" in PARAMETERS. For example:

PARAMETERS: {
	'resp_employee': user_14 // employee ID
}


© «Bitrix24», 2001-2024
Up