1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-15 00:15:19 +02:00
Files
OpenIntegrations/docs/en/md/Bitrix24/Deals-management/Create-deal.mdx

104 lines
3.4 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
sidebar_position: 1
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Create deal
Creates a new deal by field structure (see. GetDealStructure)
`Function CreateDeal(Val URL, Val FieldsStructure, Val Token = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
2024-12-29 17:57:09 +03:00
| FieldsStructure | --fields | Structure Of KeyAndValue | ✔ | Deal fields structure (see. GetDealStructure) |
2024-10-15 15:15:47 +03:00
| Token | --token | String | ✖ | Access token, when app auth method used |
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [crm.deal.add](https://dev.1c-bitrix.ru/rest_help/crm/cdeals/crm_deal_add.php)
:::
<br/>
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="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");
2024-12-08 12:04:47 +03:00
URL = "https://b24-ar17wx.bitrix24.by/rest/1/ps5...";
Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure);
FieldsStructure.Insert("TITLE" , "Another deal");
FieldsStructure.Insert("CLOSEDATE", "2031-01-01");
2024-09-24 11:38:18 +03:00
URL = "b24-ar17wx.bitrix24.by";
2025-01-11 21:13:24 +03:00
Token = "14bb8267006e9f06006b12e400000001000...";
Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure, Token);
```
2024-10-15 09:53:37 +03:00
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint bitrix24 CreateDeal \
2024-10-22 08:59:24 +03:00
--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 "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint bitrix24 CreateDeal ^
2024-10-22 08:59:24 +03:00
--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 "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
```json title="Result"
2024-08-30 10:23:13 +03:00
{
2024-10-09 09:42:00 +03:00
"result": 774,
2024-08-30 10:23:13 +03:00
"time": {
2024-10-09 09:42:00 +03:00
"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
2024-08-30 10:23:13 +03:00
}
}
```