0

I want to start a Bitrix workflow with an API call. But I allways get as answer, that the DOCUMENT_ID is wrong. What I handover for the DOCUMENT_ID is: ['crm', 'CCrmDocumentDeal', '12345'] '12345' is the deal ID, but what is 'CCrmDocumentDeal'? I copied it from the documentation, but I dont find what it is and where I find how this should be in my system. Can somebody explain me this part of the bizproc.workflow.start Method?

Starting a Bitrix workflow with an API call.

yolohawi
  • 1
  • 2

2 Answers2

1

Regarding documentation you should provide ID of the Deal as DEAL_12345. So your DOCUMENT_ID should be ['crm', 'CCrmDocumentDeal', 'DEAL_12345']

Nikolaj Sarry
  • 245
  • 7
  • 18
0

you can use bitrix rest api to trigger any workflow

method: bizproc.workflow.start
method type: post
parameter: {
    "TEMPLATE_ID": `replace_your_workflow_id`,
    "DOCUMENT_ID": [
        "crm",
        "CCrmDocumentDeal",
        "DEAL_`replace_your_deal_id`"
    ]
}

Sample PHP Code to trigger worfklow where workflow template id is 823

$deal_id="1";
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => BITRIX_WEBHOOK."bizproc.workflow.start",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\n\t\"TEMPLATE_ID\": 823,\n    \"DOCUMENT_ID\": [\"crm\", \"CCrmDocumentDeal\", \"DEAL_".$deal_id."\"]\n}",
    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "content-type: application/json"
    ),
));
Yuvraj Hinger
  • 198
  • 1
  • 6
  • I tried it like this with the developer kit in Bitrix, there I have then this URL for my request: bizproc.workflow.start.json?TEMPLATE_ID=123&DOCUMENT_ID=["crm","CCrmDocumentDeal","DEAL_123456"] But this still gives me "Wrong Document ID" as error. – yolohawi Mar 27 '23 at 06:49