Create deal
Creates a new deal by field structure (see. GetDealStructure)
Function CreateDeal(Val URL, Val FieldsStructure, Val Token = "") Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
FieldsStructure | --fields | Structure of KeyAndValue | ✔ | Deal fields structure (see. GetDealStructure) |
Token | --token | String | ✖ | Access token, when app auth method used |
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
tip
Method at API documentation: crm.deal.add
1C:Enterprise/OneScript code example
FieldsStructure = New Structure;
FieldsStructure.Insert("TITLE" , "Planned sale");
FieldsStructure.Insert("TYPE_ID" , "GOODS");
FieldsStructure.Insert("STAGE_ID" , "NEW");
FieldsStructure.Insert("COMPANY_ID" , 1);
FieldsStructure.Insert("CONTACT_ID" , 3);
FieldsStructure.Insert("OPENED" , "Y");
FieldsStructure.Insert("ASSIGNED_BY_ID", 1);
FieldsStructure.Insert("PROBABILITY" , 30);
FieldsStructure.Insert("CURRENCY_ID" , "USD");
FieldsStructure.Insert("OPPORTUNITY" , 5000);
FieldsStructure.Insert("CATEGORY_ID" , 5);
FieldsStructure.Insert("BEGINDATE" , "2024-01-01");
FieldsStructure.Insert("CLOSEDATE" , "2030-01-01");
URL = "https://b24-ar17wx.bitrix24.by/rest/1/yg2...";
Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure);
FieldsStructure.Insert("TITLE" , "Another deal");
FieldsStructure.Insert("CLOSEDATE", "2031-01-01");
URL = "b24-ar17wx.bitrix24.by";
Token = "2f4e4067006e9f06006b12e400000001000...";
Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure, Token);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint bitrix24 CreateDeal \
--url "b24-ar17wx.bitrix24.by" \
--fields "{'TITLE':'Another deal','TYPE_ID':'GOODS','STAGE_ID':'NEW','COMPANY_ID':1,'CONTACT_ID':3,'OPENED':'Y','ASSIGNED_BY_ID':1,'PROBABILITY':30,'CURRENCY_ID':'USD','OPPORTUNITY':5000,'CATEGORY_ID':5,'BEGINDATE':'2024-01-01','CLOSEDATE':'2031-01-01'}" \
--token "***"
:: JSON data can also be passed as a path to a .json file
oint bitrix24 CreateDeal ^
--url "b24-ar17wx.bitrix24.by" ^
--fields "{'TITLE':'Another deal','TYPE_ID':'GOODS','STAGE_ID':'NEW','COMPANY_ID':1,'CONTACT_ID':3,'OPENED':'Y','ASSIGNED_BY_ID':1,'PROBABILITY':30,'CURRENCY_ID':'USD','OPPORTUNITY':5000,'CATEGORY_ID':5,'BEGINDATE':'2024-01-01','CLOSEDATE':'2031-01-01'}" ^
--token "***"
Result
{
"result": 774,
"time": {
"start": 1728454946.42456,
"finish": 1728454946.95557,
"duration": 0.531003952026367,
"processing": 0.498440027236938,
"date_start": "2024-10-09T09:22:26+03:00",
"date_finish": "2024-10-09T09:22:26+03:00",
"operating_reset_at": 1728455546,
"operating": 0.498416900634766
}
}