mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-05-29 23:17:45 +02:00
104 lines
3.4 KiB
Plaintext
Vendored
104 lines
3.4 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 1
|
|
---
|
|
|
|
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`
|
|
|
|
| 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
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [crm.deal.add](https://dev.1c-bitrix.ru/rest_help/crm/cdeals/crm_deal_add.php)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```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");
|
|
|
|
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");
|
|
|
|
URL = "b24-ar17wx.bitrix24.by";
|
|
Token = "14bb8267006e9f06006b12e400000001000...";
|
|
|
|
Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure, Token);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# 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 "***"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: 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 "***"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="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
|
|
}
|
|
}
|
|
```
|