n8n-nodes-pragma-bitrix24 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +51 -0
- package/README.md +340 -0
- package/dist/credentials/Bitrix24Api.credentials.js +55 -0
- package/dist/nodes/Bitrix24/Bitrix24.node.js +1410 -0
- package/dist/nodes/Bitrix24/Company.js +17 -0
- package/dist/nodes/Bitrix24/Contact.js +31 -0
- package/dist/nodes/Bitrix24/Deal.js +17 -0
- package/dist/nodes/Bitrix24/Helpers.js +300 -0
- package/dist/nodes/Bitrix24/Lead.js +17 -0
- package/dist/nodes/Bitrix24/SmartProcess.js +1 -0
- package/dist/nodes/Bitrix24/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24/types.js +58 -0
- package/dist/nodes/Bitrix24AI/Bitrix24AI.node.js +205 -0
- package/dist/nodes/Bitrix24App/Bitrix24App.node.js +179 -0
- package/dist/nodes/Bitrix24Auxiliary/Bitrix24Auxiliary.node.js +566 -0
- package/dist/nodes/Bitrix24Booking/Bitrix24Booking.node.js +871 -0
- package/dist/nodes/Bitrix24Calendar/Bitrix24Calendar.node.js +471 -0
- package/dist/nodes/Bitrix24ChatBot/Bitrix24ChatBot.node.js +522 -0
- package/dist/nodes/Bitrix24Commerce/Bitrix24Commerce.node.js +431 -0
- package/dist/nodes/Bitrix24Department/Bitrix24Department.node.js +317 -0
- package/dist/nodes/Bitrix24Disk/Bitrix24Disk.node.js +334 -0
- package/dist/nodes/Bitrix24Document/Bitrix24Document.node.js +280 -0
- package/dist/nodes/Bitrix24Entity/Bitrix24Entity.node.js +263 -0
- package/dist/nodes/Bitrix24Group/Bitrix24Group.node.js +327 -0
- package/dist/nodes/Bitrix24Lists/Bitrix24Lists.node.js +406 -0
- package/dist/nodes/Bitrix24Log/Bitrix24Log.node.js +309 -0
- package/dist/nodes/Bitrix24Mail/Bitrix24Mail.node.js +109 -0
- package/dist/nodes/Bitrix24MessageService/Bitrix24MessageService.node.js +218 -0
- package/dist/nodes/Bitrix24OpenChannels/Bitrix24OpenChannels.node.js +379 -0
- package/dist/nodes/Bitrix24PaySystem/Bitrix24PaySystem.node.js +241 -0
- package/dist/nodes/Bitrix24Pipeline/Bitrix24Pipeline.node.js +553 -0
- package/dist/nodes/Bitrix24Pipeline/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Sale/Bitrix24Sale.node.js +391 -0
- package/dist/nodes/Bitrix24Scrum/Bitrix24Scrum.node.js +555 -0
- package/dist/nodes/Bitrix24Scrum/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Sign/Bitrix24Sign.node.js +132 -0
- package/dist/nodes/Bitrix24Social/Bitrix24Social.node.js +224 -0
- package/dist/nodes/Bitrix24Task/Bitrix24Task.node.js +444 -0
- package/dist/nodes/Bitrix24Telephony/Bitrix24Telephony.node.js +511 -0
- package/dist/nodes/Bitrix24Timeman/Bitrix24Timeman.node.js +196 -0
- package/dist/nodes/Bitrix24Tool/Bitrix24Tool.node.js +1035 -0
- package/dist/nodes/Bitrix24Tool/bitrix24.svg +7 -0
- package/dist/nodes/Bitrix24Trigger/Bitrix24Trigger.node.js +184 -0
- package/dist/nodes/Bitrix24User/Bitrix24User.node.js +351 -0
- package/dist/nodes/Bitrix24UserField/Bitrix24UserField.node.js +386 -0
- package/dist/nodes/Bitrix24UserField/bitrix24.svg +7 -0
- package/dist/nodes/shared/bitrix24.svg +7 -0
- package/dist/nodes/shared/localization.js +189 -0
- package/dist/nodes/shared/types.js +22 -0
- package/index.js +10 -0
- package/package.json +108 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bitrix24 Calendar — Нода управления календарём
|
|
4
|
+
*
|
|
5
|
+
* Bitrix24 PRAGMA.by nodes for n8n
|
|
6
|
+
* Профессиональная интеграция с Битрикс24.
|
|
7
|
+
*
|
|
8
|
+
* @author PRAGMA & Азбука Решений
|
|
9
|
+
* @copyright 2026 PRAGMA (https://pragma.by/) & Азбука Решений (https://abc-solution.ru/)
|
|
10
|
+
*
|
|
11
|
+
* Контакты:
|
|
12
|
+
* 🇧🇾 PRAGMA: +375 (44) 702-70-90 | https://pragma.by/
|
|
13
|
+
* 🇷🇺 Азбука Решений: +7 (939) 555-19-60 | https://abc-solution.ru/
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Bitrix24Calendar = void 0;
|
|
17
|
+
const Helpers_1 = require("../Bitrix24/Helpers");
|
|
18
|
+
class Bitrix24Calendar {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.description = {
|
|
21
|
+
displayName: 'Bitrix24 Календарь',
|
|
22
|
+
name: 'bitrix24Calendar',
|
|
23
|
+
icon: 'file:bitrix24.svg',
|
|
24
|
+
group: ['transform'],
|
|
25
|
+
version: 1,
|
|
26
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
27
|
+
description: 'Управление событиями календаря в Битрикс24: встречи, бронирование, доступность',
|
|
28
|
+
defaults: {
|
|
29
|
+
name: 'Bitrix24 Календарь',
|
|
30
|
+
},
|
|
31
|
+
inputs: ['main'],
|
|
32
|
+
outputs: ['main'],
|
|
33
|
+
credentials: [
|
|
34
|
+
{
|
|
35
|
+
name: 'bitrix24Api',
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
properties: [
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Ресурс',
|
|
42
|
+
name: 'resource',
|
|
43
|
+
type: 'options',
|
|
44
|
+
noDataExpression: true,
|
|
45
|
+
options: [
|
|
46
|
+
{
|
|
47
|
+
name: 'Событие',
|
|
48
|
+
value: 'event',
|
|
49
|
+
description: 'События календаря: встречи, звонки, напоминания',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Бронирование ресурса',
|
|
53
|
+
value: 'resource_booking',
|
|
54
|
+
description: 'Бронирование переговорных, оборудования и других ресурсов',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
default: 'event',
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Операция',
|
|
62
|
+
name: 'operation',
|
|
63
|
+
type: 'options',
|
|
64
|
+
noDataExpression: true,
|
|
65
|
+
options: [
|
|
66
|
+
// Операции с событиями
|
|
67
|
+
{
|
|
68
|
+
name: 'Создать',
|
|
69
|
+
value: 'create',
|
|
70
|
+
action: 'Создать событие',
|
|
71
|
+
description: 'Создать новое событие в календаре',
|
|
72
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Получить',
|
|
76
|
+
value: 'get',
|
|
77
|
+
action: 'Получить событие',
|
|
78
|
+
description: 'Получить событие по ID',
|
|
79
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Список',
|
|
83
|
+
value: 'list',
|
|
84
|
+
action: 'Получить список событий',
|
|
85
|
+
description: 'Получить события за период',
|
|
86
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'Обновить',
|
|
90
|
+
value: 'update',
|
|
91
|
+
action: 'Обновить событие',
|
|
92
|
+
description: 'Изменить существующее событие',
|
|
93
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Удалить',
|
|
97
|
+
value: 'delete',
|
|
98
|
+
action: 'Удалить событие',
|
|
99
|
+
description: 'Удалить событие из календаря',
|
|
100
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Проверить доступность',
|
|
104
|
+
value: 'accessibility',
|
|
105
|
+
action: 'Проверить занятость',
|
|
106
|
+
description: 'Проверить доступность пользователей для планирования встречи',
|
|
107
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'Установить статус',
|
|
111
|
+
value: 'status',
|
|
112
|
+
action: 'Установить статус участия',
|
|
113
|
+
description: 'Принять или отклонить приглашение на встречу',
|
|
114
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Attach Entity',
|
|
118
|
+
value: 'attach',
|
|
119
|
+
action: 'Attach file or entity',
|
|
120
|
+
displayOptions: { show: { resource: ['event'] } },
|
|
121
|
+
},
|
|
122
|
+
// Booking Operations
|
|
123
|
+
{
|
|
124
|
+
name: 'List',
|
|
125
|
+
value: 'list',
|
|
126
|
+
action: 'List bookings',
|
|
127
|
+
displayOptions: { show: { resource: ['resource_booking'] } },
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
default: 'create',
|
|
131
|
+
required: true,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Meeting Status',
|
|
135
|
+
name: 'meetingStatus',
|
|
136
|
+
type: 'options',
|
|
137
|
+
options: [
|
|
138
|
+
{ name: 'Accept (Y)', value: 'Y' },
|
|
139
|
+
{ name: 'Decline (N)', value: 'N' },
|
|
140
|
+
{ name: 'Question (Q)', value: 'Q' },
|
|
141
|
+
],
|
|
142
|
+
default: 'Y',
|
|
143
|
+
displayOptions: {
|
|
144
|
+
show: {
|
|
145
|
+
resource: ['event'],
|
|
146
|
+
operation: ['status'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
description: 'Status to set',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
displayName: 'Users (IDs)',
|
|
153
|
+
name: 'users',
|
|
154
|
+
type: 'string',
|
|
155
|
+
default: '',
|
|
156
|
+
required: true,
|
|
157
|
+
displayOptions: {
|
|
158
|
+
show: {
|
|
159
|
+
resource: ['event'],
|
|
160
|
+
operation: ['accessibility'],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
description: 'List of User IDs to check, separated by comma. Defaults to current user if empty.',
|
|
164
|
+
},
|
|
165
|
+
// Attach Fields
|
|
166
|
+
{
|
|
167
|
+
displayName: 'Entity Type',
|
|
168
|
+
name: 'attachEntity',
|
|
169
|
+
type: 'options',
|
|
170
|
+
options: [
|
|
171
|
+
{ name: 'Deal', value: 'deal' },
|
|
172
|
+
{ name: 'Lead', value: 'lead' },
|
|
173
|
+
{ name: 'Task', value: 'task' },
|
|
174
|
+
],
|
|
175
|
+
default: 'deal',
|
|
176
|
+
displayOptions: { show: { resource: ['event'], operation: ['attach'] } },
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
displayName: 'Entity ID',
|
|
180
|
+
name: 'attachId',
|
|
181
|
+
type: 'string',
|
|
182
|
+
default: '',
|
|
183
|
+
displayOptions: { show: { resource: ['event'], operation: ['attach'] } },
|
|
184
|
+
description: 'ID of the entity to attach',
|
|
185
|
+
},
|
|
186
|
+
// Booking Fields
|
|
187
|
+
{
|
|
188
|
+
displayName: 'Filter (JSON)',
|
|
189
|
+
name: 'jsonParameters',
|
|
190
|
+
type: 'json',
|
|
191
|
+
default: '',
|
|
192
|
+
displayOptions: { show: { resource: ['resource_booking'], operation: ['list'] } },
|
|
193
|
+
description: 'Filter parameters for booking',
|
|
194
|
+
},
|
|
195
|
+
// Fields
|
|
196
|
+
{
|
|
197
|
+
displayName: 'Name',
|
|
198
|
+
name: 'name',
|
|
199
|
+
type: 'string',
|
|
200
|
+
default: '',
|
|
201
|
+
required: true,
|
|
202
|
+
displayOptions: {
|
|
203
|
+
show: {
|
|
204
|
+
resource: ['event'], // Added resource check
|
|
205
|
+
operation: ['create'],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
description: 'Event name',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
displayName: 'Name',
|
|
212
|
+
name: 'name',
|
|
213
|
+
type: 'string',
|
|
214
|
+
default: '',
|
|
215
|
+
displayOptions: {
|
|
216
|
+
show: {
|
|
217
|
+
resource: ['event'],
|
|
218
|
+
operation: ['update'],
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
description: 'Event name',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
displayName: 'Description',
|
|
225
|
+
name: 'description',
|
|
226
|
+
type: 'string',
|
|
227
|
+
default: '',
|
|
228
|
+
displayOptions: {
|
|
229
|
+
show: {
|
|
230
|
+
resource: ['event'],
|
|
231
|
+
operation: ['create', 'update'],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
description: 'Event description',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
displayName: 'Start Date',
|
|
238
|
+
name: 'from',
|
|
239
|
+
type: 'dateTime',
|
|
240
|
+
default: '',
|
|
241
|
+
required: true,
|
|
242
|
+
displayOptions: {
|
|
243
|
+
show: {
|
|
244
|
+
resource: ['event'],
|
|
245
|
+
operation: ['create', 'accessibility'],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
description: 'Start date and time',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
displayName: 'Start Date',
|
|
252
|
+
name: 'from',
|
|
253
|
+
type: 'dateTime',
|
|
254
|
+
default: '',
|
|
255
|
+
displayOptions: {
|
|
256
|
+
show: {
|
|
257
|
+
resource: ['event'],
|
|
258
|
+
operation: ['update'],
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
description: 'Start date and time',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
displayName: 'End Date',
|
|
265
|
+
name: 'to',
|
|
266
|
+
type: 'dateTime',
|
|
267
|
+
default: '',
|
|
268
|
+
required: true,
|
|
269
|
+
displayOptions: {
|
|
270
|
+
show: {
|
|
271
|
+
resource: ['event'],
|
|
272
|
+
operation: ['create', 'accessibility'],
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
description: 'End date and time',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
displayName: 'End Date',
|
|
279
|
+
name: 'to',
|
|
280
|
+
type: 'dateTime',
|
|
281
|
+
default: '',
|
|
282
|
+
displayOptions: {
|
|
283
|
+
show: {
|
|
284
|
+
resource: ['event'],
|
|
285
|
+
operation: ['update'],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
description: 'End date and time',
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
displayName: 'ID',
|
|
292
|
+
name: 'id',
|
|
293
|
+
type: 'string',
|
|
294
|
+
default: '',
|
|
295
|
+
required: true,
|
|
296
|
+
displayOptions: {
|
|
297
|
+
show: {
|
|
298
|
+
resource: ['event'],
|
|
299
|
+
operation: ['get', 'update', 'delete', 'status', 'attach'],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
description: 'Event ID',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
displayName: 'Calendar Type',
|
|
306
|
+
name: 'type',
|
|
307
|
+
type: 'options',
|
|
308
|
+
options: [
|
|
309
|
+
{ name: 'User', value: 'user' },
|
|
310
|
+
{ name: 'Group', value: 'group' },
|
|
311
|
+
{ name: 'Company', value: 'company_calendar' },
|
|
312
|
+
],
|
|
313
|
+
default: 'user',
|
|
314
|
+
displayOptions: {
|
|
315
|
+
show: {
|
|
316
|
+
resource: ['event'],
|
|
317
|
+
operation: ['list', 'create'],
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
description: 'Calendar owner type',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
displayName: 'Owner ID',
|
|
324
|
+
name: 'ownerId',
|
|
325
|
+
type: 'string',
|
|
326
|
+
default: '',
|
|
327
|
+
displayOptions: {
|
|
328
|
+
show: {
|
|
329
|
+
resource: ['event'],
|
|
330
|
+
operation: ['list', 'create'],
|
|
331
|
+
type: ['user', 'group'],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
description: 'ID of the user or group',
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
async execute() {
|
|
340
|
+
const items = this.getInputData();
|
|
341
|
+
const returnData = [];
|
|
342
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
343
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
344
|
+
for (let i = 0; i < items.length; i++) {
|
|
345
|
+
try {
|
|
346
|
+
let endpoint = '';
|
|
347
|
+
let body = {};
|
|
348
|
+
if (operation === 'create' || operation === 'update') {
|
|
349
|
+
endpoint = operation === 'create' ? 'calendar.event.add' : 'calendar.event.update';
|
|
350
|
+
const type = this.getNodeParameter('type', i, 'user');
|
|
351
|
+
const ownerId = this.getNodeParameter('ownerId', i, '');
|
|
352
|
+
if (operation === 'create') {
|
|
353
|
+
body.type = type;
|
|
354
|
+
body.ownerId = ownerId; // ownerId might be userId depending on bitrix version context
|
|
355
|
+
}
|
|
356
|
+
const name = this.getNodeParameter('name', i, '');
|
|
357
|
+
if (name)
|
|
358
|
+
body.name = name;
|
|
359
|
+
const description = this.getNodeParameter('description', i, '');
|
|
360
|
+
if (description)
|
|
361
|
+
body.description = description;
|
|
362
|
+
const from = this.getNodeParameter('from', i, '');
|
|
363
|
+
if (from)
|
|
364
|
+
body.from = from;
|
|
365
|
+
const to = this.getNodeParameter('to', i, '');
|
|
366
|
+
if (to)
|
|
367
|
+
body.to = to;
|
|
368
|
+
if (operation === 'update') {
|
|
369
|
+
const id = this.getNodeParameter('id', i);
|
|
370
|
+
body.id = id;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (operation === 'get') {
|
|
374
|
+
endpoint = 'calendar.event.get.by.id';
|
|
375
|
+
const id = this.getNodeParameter('id', i);
|
|
376
|
+
body = { id };
|
|
377
|
+
}
|
|
378
|
+
if (operation === 'delete') {
|
|
379
|
+
endpoint = 'calendar.event.delete';
|
|
380
|
+
const id = this.getNodeParameter('id', i);
|
|
381
|
+
const type = this.getNodeParameter('type', i, 'user'); // Delete might need type
|
|
382
|
+
const ownerId = this.getNodeParameter('ownerId', i, '');
|
|
383
|
+
body = { id, type, ownerId };
|
|
384
|
+
}
|
|
385
|
+
if (operation === 'list') {
|
|
386
|
+
endpoint = 'calendar.event.get';
|
|
387
|
+
const type = this.getNodeParameter('type', i, 'user');
|
|
388
|
+
const ownerId = this.getNodeParameter('ownerId', i, '');
|
|
389
|
+
body = { type, ownerId };
|
|
390
|
+
}
|
|
391
|
+
if (operation === 'accessibility') {
|
|
392
|
+
endpoint = 'calendar.accessibility.get';
|
|
393
|
+
const from = this.getNodeParameter('from', i);
|
|
394
|
+
const to = this.getNodeParameter('to', i);
|
|
395
|
+
const usersStr = this.getNodeParameter('users', i);
|
|
396
|
+
const users = usersStr.split(',').map(u => parseInt(u.trim())).filter(u => !isNaN(u));
|
|
397
|
+
body = { from, to, users };
|
|
398
|
+
}
|
|
399
|
+
if (operation === 'status') {
|
|
400
|
+
endpoint = 'calendar.meeting.status.set';
|
|
401
|
+
body.eventId = this.getNodeParameter('id', i);
|
|
402
|
+
body.status = this.getNodeParameter('meetingStatus', i);
|
|
403
|
+
}
|
|
404
|
+
if (operation === 'attach') {
|
|
405
|
+
// calendar.event.attach? No, 'calendar.event.update' with ENTITY_TYPE?
|
|
406
|
+
// Or 'userfield' manipulation?
|
|
407
|
+
// Actually docs mention 'calendar.event.file.add' (not widely standard) or binding.
|
|
408
|
+
// Let's check bitrix docs...
|
|
409
|
+
// "Attach CRM entity": crm.activity.binding.add?
|
|
410
|
+
// If attaching to Calendar Event, usually it's `calendar.event.update` -> `crm_fields`.
|
|
411
|
+
// But `calendar.event.update` fields are tricky.
|
|
412
|
+
// Wait, looking at list... "Attach Entity".
|
|
413
|
+
// If we mean "Attach file", use `calendar.event.attaches.add`? (Not standard).
|
|
414
|
+
// Standard way: `calendar.event.update` with `CRM_FIELDS` array.
|
|
415
|
+
endpoint = 'calendar.event.update';
|
|
416
|
+
body.id = this.getNodeParameter('id', i);
|
|
417
|
+
const type = this.getNodeParameter('attachEntity', i);
|
|
418
|
+
const id = this.getNodeParameter('attachId', i);
|
|
419
|
+
// CRM_FIELDS = ['CO_123', 'L_55'] (Company 123, Lead 55)
|
|
420
|
+
// Prefixes: CO (Company), C (Contact), L (Lead), D (Deal).
|
|
421
|
+
let prefix = '';
|
|
422
|
+
if (type === 'deal')
|
|
423
|
+
prefix = 'D_';
|
|
424
|
+
if (type === 'lead')
|
|
425
|
+
prefix = 'L_';
|
|
426
|
+
if (type === 'task')
|
|
427
|
+
prefix = 'T_'; // Task usually via UF_TASK?
|
|
428
|
+
// Let's assume standard CRM binding.
|
|
429
|
+
body.crm_fields = [prefix + id];
|
|
430
|
+
}
|
|
431
|
+
// Booking
|
|
432
|
+
if (resource === 'resource_booking') {
|
|
433
|
+
if (operation === 'list') {
|
|
434
|
+
endpoint = 'calendar.resource.booking.list';
|
|
435
|
+
const params = JSON.parse(this.getNodeParameter('jsonParameters', i, '{}'));
|
|
436
|
+
body = { ...params };
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', endpoint + '.json', body);
|
|
440
|
+
let result = response.result;
|
|
441
|
+
if (Array.isArray(result)) {
|
|
442
|
+
for (const item of result) {
|
|
443
|
+
returnData.push({
|
|
444
|
+
json: item,
|
|
445
|
+
pairedItem: { item: i },
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
returnData.push({
|
|
451
|
+
json: result,
|
|
452
|
+
pairedItem: { item: i },
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
if (this.continueOnFail()) {
|
|
458
|
+
const err = error;
|
|
459
|
+
returnData.push({
|
|
460
|
+
json: { error: err.message },
|
|
461
|
+
pairedItem: { item: i },
|
|
462
|
+
});
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return [returnData];
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
exports.Bitrix24Calendar = Bitrix24Calendar;
|