0
# Records Management
1
2
The Records Management module provides comprehensive CRUD operations for CRM records, including bulk operations, lead conversion, photo management, and advanced search capabilities.
3
4
## Capabilities
5
6
### Core Record Operations
7
8
Primary interface for all record-related operations in Zoho CRM.
9
10
```javascript { .api }
11
/**
12
* Main operations class for CRM record management
13
*/
14
class RecordOperations {
15
/**
16
* Retrieve multiple records from a module
17
* @param moduleAPIName - API name of the CRM module (e.g., "Leads", "Contacts", "Accounts")
18
* @param paramInstance - Optional parameters for filtering and pagination
19
* @param headerInstance - Optional headers for request customization
20
* @returns Promise with APIResponse containing record data
21
*/
22
getRecords(moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
23
24
/**
25
* Create new records in a module
26
* @param moduleAPIName - API name of the CRM module
27
* @param request - Body wrapper containing record data to create
28
* @returns Promise with APIResponse containing creation results
29
*/
30
createRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
31
32
/**
33
* Update existing records in a module
34
* @param moduleAPIName - API name of the CRM module
35
* @param request - Body wrapper containing record data to update
36
* @returns Promise with APIResponse containing update results
37
*/
38
updateRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
39
40
/**
41
* Delete multiple records from a module
42
* @param moduleAPIName - API name of the CRM module
43
* @param paramInstance - Parameters specifying records to delete
44
* @returns Promise with APIResponse containing deletion results
45
*/
46
deleteRecords(moduleAPIName: string, paramInstance: ParameterMap): Promise<APIResponse>;
47
48
/**
49
* Create or update records (upsert operation)
50
* @param moduleAPIName - API name of the CRM module
51
* @param request - Body wrapper containing record data for upsert
52
* @returns Promise with APIResponse containing upsert results
53
*/
54
upsertRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
55
56
/**
57
* Get a specific record by ID
58
* @param moduleAPIName - API name of the CRM module
59
* @param recordId - Unique identifier of the record
60
* @param paramInstance - Optional parameters for field selection
61
* @param headerInstance - Optional headers for request customization
62
* @returns Promise with APIResponse containing record data
63
*/
64
getRecord(moduleAPIName: string, recordId: BigInt, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
65
66
/**
67
* Update a specific record by ID
68
* @param moduleAPIName - API name of the CRM module
69
* @param recordId - Unique identifier of the record
70
* @param request - Body wrapper containing updated record data
71
* @returns Promise with APIResponse containing update results
72
*/
73
updateRecord(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
74
75
/**
76
* Delete a specific record by ID
77
* @param moduleAPIName - API name of the CRM module
78
* @param recordId - Unique identifier of the record
79
* @param paramInstance - Optional parameters for deletion
80
* @returns Promise with APIResponse containing deletion results
81
*/
82
deleteRecord(moduleAPIName: string, recordId: BigInt, paramInstance?: ParameterMap): Promise<APIResponse>;
83
}
84
```
85
86
**Basic Record Operations Example:**
87
88
```javascript
89
const { RecordOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/record_operations");
90
const { BodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/body_wrapper");
91
const { Record } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/record");
92
93
// Get records
94
const recordOperations = new RecordOperations();
95
const response = await recordOperations.getRecords("Leads");
96
97
// Create a new record
98
const record = new Record();
99
record.addFieldValue("Company", "Acme Corp");
100
record.addFieldValue("Last_Name", "Doe");
101
record.addFieldValue("First_Name", "John");
102
record.addFieldValue("Email", "john.doe@acme.com");
103
104
const bodyWrapper = new BodyWrapper();
105
bodyWrapper.setData([record]);
106
107
const createResponse = await recordOperations.createRecords("Leads", bodyWrapper);
108
109
// Update a record
110
record.setId("123456789012345678");
111
record.addFieldValue("Company", "Updated Company Name");
112
113
const updateResponse = await recordOperations.updateRecord("Leads", "123456789012345678", bodyWrapper);
114
115
// Delete a record
116
const deleteResponse = await recordOperations.deleteRecord("Leads", "123456789012345678");
117
```
118
119
### Advanced Record Operations
120
121
Specialized operations for deleted records, search, and mass updates.
122
123
```javascript { .api }
124
/**
125
* Extended record operations for advanced use cases
126
*/
127
class RecordOperations {
128
/**
129
* Get deleted records from a module
130
* @param moduleAPIName - API name of the CRM module
131
* @param paramInstance - Optional parameters for filtering deleted records
132
* @param headerInstance - Optional headers for request customization
133
* @returns Promise with APIResponse containing deleted record data
134
*/
135
getDeletedRecords(moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
136
137
/**
138
* Search records using criteria
139
* @param moduleAPIName - API name of the CRM module
140
* @param paramInstance - Parameters containing search criteria
141
* @returns Promise with APIResponse containing search results
142
*/
143
searchRecords(moduleAPIName: string, paramInstance?: ParameterMap): Promise<APIResponse>;
144
145
/**
146
* Perform mass update operations on multiple records
147
* @param moduleAPIName - API name of the CRM module
148
* @param request - Body wrapper containing mass update specifications
149
* @returns Promise with APIResponse containing mass update results
150
*/
151
massUpdateRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
152
153
/**
154
* Get the status of a mass update operation
155
* @param moduleAPIName - API name of the CRM module
156
* @param paramInstance - Optional parameters for filtering mass update status
157
* @returns Promise with APIResponse containing mass update status
158
*/
159
getMassUpdateStatus(moduleAPIName: string, paramInstance?: ParameterMap): Promise<APIResponse>;
160
161
/**
162
* Get a record using external ID field
163
* @param externalFieldValue - Value of the external field
164
* @param moduleAPIName - API name of the CRM module
165
* @param paramInstance - Optional parameters for field selection
166
* @param headerInstance - Optional headers for request customization
167
* @returns Promise with APIResponse containing record data
168
*/
169
getRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
170
171
/**
172
* Update a record using external ID field
173
* @param externalFieldValue - Value of the external field
174
* @param moduleAPIName - API name of the CRM module
175
* @param request - Body wrapper containing updated record data
176
* @param headerInstance - Optional headers for request customization
177
* @returns Promise with APIResponse containing update results
178
*/
179
updateRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, request: BodyWrapper, headerInstance?: HeaderMap): Promise<APIResponse>;
180
181
/**
182
* Delete a record using external ID field
183
* @param externalFieldValue - Value of the external field
184
* @param moduleAPIName - API name of the CRM module
185
* @param paramInstance - Optional parameters for deletion
186
* @param headerInstance - Optional headers for request customization
187
* @returns Promise with APIResponse containing deletion results
188
*/
189
deleteRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
190
}
191
```
192
193
**Advanced Operations Example:**
194
195
```javascript
196
const { GetRecordsParam, GetDeletedRecordsParam, SearchRecordsParam } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/record_operations");
197
const { ParameterMap } = require("@zohocrm/nodejs-sdk-2.0/routes/parameter_map");
198
199
// Search for records
200
const searchParams = new ParameterMap();
201
await searchParams.add(SearchRecordsParam.CRITERIA, "(Company:equals:Acme Corp)");
202
const searchResponse = await recordOperations.searchRecords("Leads", searchParams);
203
204
// Get deleted records
205
const deletedParams = new ParameterMap();
206
await deletedParams.add(GetDeletedRecordsParam.TYPE, "all");
207
const deletedResponse = await recordOperations.getDeletedRecords("Leads", deletedParams);
208
209
// Mass update records
210
const massUpdateWrapper = new BodyWrapper();
211
// Configure mass update data...
212
const massUpdateResponse = await recordOperations.massUpdateRecords("Leads", massUpdateWrapper);
213
```
214
215
### Lead Conversion
216
217
Convert leads to accounts, contacts, and deals.
218
219
```javascript { .api }
220
/**
221
* Lead conversion operations
222
*/
223
class RecordOperations {
224
/**
225
* Convert a lead to account, contact, and optionally a deal
226
* @param leadId - ID of the lead to convert
227
* @param request - Body wrapper containing conversion details
228
* @returns Promise with APIResponse containing conversion results
229
*/
230
convertLead(leadId: BigInt, request: BodyWrapper): Promise<APIResponse>;
231
}
232
```
233
234
**Lead Conversion Example:**
235
236
```javascript
237
const { ConvertBodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/convert_body_wrapper");
238
const { LeadConverter } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/lead_converter");
239
240
// Convert a lead
241
const converter = new LeadConverter();
242
converter.setOverwrite(true);
243
converter.setNotifyLeadOwner(true);
244
converter.setNotifyNewEntityOwner(true);
245
246
const convertWrapper = new ConvertBodyWrapper();
247
convertWrapper.setData([converter]);
248
249
const conversionResponse = await recordOperations.convertLead(123456789012345678n, convertWrapper);
250
```
251
252
### Photo Management
253
254
Upload, download, and delete record photos.
255
256
```javascript { .api }
257
/**
258
* Photo management operations for records
259
*/
260
class RecordOperations {
261
/**
262
* Get photo associated with a record
263
* @param moduleAPIName - API name of the CRM module
264
* @param recordId - ID of the record
265
* @returns Promise with APIResponse containing photo file
266
*/
267
getPhoto(moduleAPIName: string, recordId: BigInt): Promise<APIResponse>;
268
269
/**
270
* Upload photo for a record
271
* @param moduleAPIName - API name of the CRM module
272
* @param recordId - ID of the record
273
* @param request - File body wrapper containing photo data
274
* @returns Promise with APIResponse containing upload results
275
*/
276
uploadPhoto(moduleAPIName: string, recordId: BigInt, request: FileBodyWrapper): Promise<APIResponse>;
277
278
/**
279
* Delete photo associated with a record
280
* @param moduleAPIName - API name of the CRM module
281
* @param recordId - ID of the record
282
* @returns Promise with APIResponse containing deletion results
283
*/
284
deletePhoto(moduleAPIName: string, recordId: BigInt): Promise<APIResponse>;
285
}
286
```
287
288
**Photo Management Example:**
289
290
```javascript
291
const { FileBodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/file_body_wrapper");
292
const fs = require("fs");
293
294
// Upload photo
295
const fileStream = fs.createReadStream("path/to/photo.jpg");
296
const fileWrapper = new FileBodyWrapper();
297
fileWrapper.setFile(fileStream);
298
299
const uploadResponse = await recordOperations.uploadPhoto("Contacts", 123456789012345678n, fileWrapper);
300
301
// Get photo
302
const photoResponse = await recordOperations.getPhoto("Contacts", 123456789012345678n);
303
304
// Delete photo
305
const deletePhotoResponse = await recordOperations.deletePhoto("Contacts", 123456789012345678n);
306
```
307
308
### Notes Operations
309
310
Comprehensive note and comment management for CRM records.
311
312
```javascript { .api }
313
/**
314
* Operations for managing notes and comments on CRM records
315
*/
316
class NotesOperations {
317
/**
318
* Get all notes with optional filtering
319
* @param paramInstance - Optional parameters for filtering and pagination
320
* @param headerInstance - Optional headers for request customization
321
* @returns Promise with APIResponse containing notes data
322
*/
323
getNotes(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
324
325
/**
326
* Create new notes
327
* @param request - Body wrapper containing note data to create
328
* @returns Promise with APIResponse containing creation results
329
*/
330
createNotes(request: BodyWrapper): Promise<APIResponse>;
331
332
/**
333
* Update existing notes
334
* @param request - Body wrapper containing updated note data
335
* @returns Promise with APIResponse containing update results
336
*/
337
updateNotes(request: BodyWrapper): Promise<APIResponse>;
338
339
/**
340
* Delete multiple notes
341
* @param paramInstance - Optional parameters specifying notes to delete
342
* @returns Promise with APIResponse containing deletion results
343
*/
344
deleteNotes(paramInstance?: ParameterMap): Promise<APIResponse>;
345
346
/**
347
* Get a specific note by ID
348
* @param noteId - Unique identifier of the note
349
* @param paramInstance - Optional parameters for field selection
350
* @param headerInstance - Optional headers for request customization
351
* @returns Promise with APIResponse containing note data
352
*/
353
getNote(noteId: BigInt, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
354
355
/**
356
* Update a specific note by ID
357
* @param noteId - Unique identifier of the note
358
* @param request - Body wrapper containing updated note data
359
* @returns Promise with APIResponse containing update results
360
*/
361
updateNote(noteId: BigInt, request: BodyWrapper): Promise<APIResponse>;
362
363
/**
364
* Delete a specific note by ID
365
* @param noteId - Unique identifier of the note
366
* @returns Promise with APIResponse containing deletion results
367
*/
368
deleteNote(noteId: BigInt): Promise<APIResponse>;
369
}
370
```
371
372
**Notes Operations Example:**
373
374
```javascript
375
const { NotesOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/notes/notes_operations");
376
const { BodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/notes/body_wrapper");
377
const { Note } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/notes/note");
378
379
const notesOp = new NotesOperations();
380
381
// Get all notes
382
const notesResponse = await notesOp.getNotes();
383
384
// Create a new note
385
const note = new Note();
386
note.setNoteTitle("Follow-up Required");
387
note.setNoteContent("Customer requested pricing information for enterprise plan");
388
note.setParentId({ id: "123456789012345678", name: "Leads" });
389
390
const bodyWrapper = new BodyWrapper();
391
bodyWrapper.setData([note]);
392
393
const createResponse = await notesOp.createNotes(bodyWrapper);
394
395
// Update a specific note
396
const updateNote = new Note();
397
updateNote.setId(987654321098765432n);
398
updateNote.setNoteContent("Updated: Customer confirmed interest in enterprise plan");
399
400
const updateWrapper = new BodyWrapper();
401
updateWrapper.setData([updateNote]);
402
403
const updateResponse = await notesOp.updateNote(987654321098765432n, updateWrapper);
404
405
// Delete a note
406
const deleteResponse = await notesOp.deleteNote(987654321098765432n);
407
```
408
409
### Record Data Model
410
411
The core record data structure for CRM entities.
412
413
```javascript { .api }
414
/**
415
* Represents a CRM record with field values and metadata
416
*/
417
class Record {
418
/** Create a new record instance */
419
constructor();
420
421
/** Get record ID */
422
getId(): string;
423
/** Set record ID */
424
setId(id: string): void;
425
426
/** Get value of a specific field */
427
getFieldValue(fieldName: string): any;
428
/** Add or update a field value */
429
addFieldValue(fieldName: string, value: any): void;
430
/** Remove a field from the record */
431
removeFieldValue(fieldName: string): void;
432
433
/** Get all field values as key-value pairs */
434
getKeyValues(): Map<string, any>;
435
/** Set all field values */
436
setKeyValues(keyValues: Map<string, any>): void;
437
438
/** Get record creation time */
439
getCreatedTime(): Date;
440
/** Get record modification time */
441
getModifiedTime(): Date;
442
443
/** Get user who created the record */
444
getCreatedBy(): User;
445
/** Get user who last modified the record */
446
getModifiedBy(): User;
447
448
/** Get record owner */
449
getOwner(): User;
450
/** Set record owner */
451
setOwner(owner: User): void;
452
453
/** Get record tags */
454
getTag(): Tag[];
455
/** Set record tags */
456
setTag(tags: Tag[]): void;
457
}
458
```
459
460
### Request/Response Wrappers
461
462
Wrapper classes for handling API requests and responses.
463
464
```javascript { .api }
465
/**
466
* Wrapper for record request bodies
467
*/
468
class BodyWrapper {
469
/** Get record data */
470
getData(): Record[];
471
/** Set record data */
472
setData(data: Record[]): void;
473
474
/** Get duplicate check fields */
475
getDuplicateCheckFields(): string[];
476
/** Set duplicate check fields */
477
setDuplicateCheckFields(fields: string[]): void;
478
479
/** Get trigger workflow rules */
480
getTrigger(): string[];
481
/** Set trigger workflow rules */
482
setTrigger(trigger: string[]): void;
483
}
484
485
/**
486
* Wrapper for record responses (GET operations)
487
*/
488
class ResponseWrapper {
489
/** Get record data from response */
490
getData(): Record[];
491
/** Get pagination info */
492
getInfo(): Info;
493
}
494
495
/**
496
* Wrapper for action responses (POST/PUT/DELETE operations)
497
*/
498
class ActionWrapper {
499
/** Get action results */
500
getData(): ActionResponse[];
501
}
502
503
/**
504
* File wrapper for photo uploads
505
*/
506
class FileBodyWrapper {
507
/** Set file stream for upload */
508
setFile(file: any): void;
509
/** Get file stream */
510
getFile(): any;
511
}
512
```
513
514
### Query Parameters and Headers
515
516
Parameters and headers for customizing record operations.
517
518
```javascript { .api }
519
/**
520
* Parameters for getRecords operation
521
*/
522
class GetRecordsParam {
523
static APPROVED: Param; // Get approved/unapproved records
524
static CONVERTED: Param; // Get converted/unconverted leads
525
static CVID: Param; // Custom view ID
526
static IDS: Param; // Specific record IDs
527
static FIELDS: Param; // Fields to retrieve
528
static SORT_BY: Param; // Sort field
529
static SORT_ORDER: Param; // Sort order (asc/desc)
530
static PAGE: Param; // Page number
531
static PER_PAGE: Param; // Records per page
532
static STARTDATETIME: Param; // Start date for filtering
533
static ENDDATETIME: Param; // End date for filtering
534
static TERRITORY_ID: Param; // Territory filter
535
static INCLUDE_CHILD: Param; // Include child territories
536
}
537
538
/**
539
* Headers for getRecords operation
540
*/
541
class GetRecordsHeader {
542
static IF_MODIFIED_SINCE: Header; // Get records modified since date
543
static X_EXTERNAL: Header; // External system identifier
544
}
545
546
/**
547
* Parameters for deleteRecords operation
548
*/
549
class DeleteRecordsParam {
550
static IDS: Param; // Record IDs to delete
551
static WF_TRIGGER: Param; // Trigger workflows
552
}
553
554
/**
555
* Parameters for searchRecords operation
556
*/
557
class SearchRecordsParam {
558
static CRITERIA: Param; // Search criteria
559
static EMAIL: Param; // Email search
560
static PHONE: Param; // Phone search
561
static WORD: Param; // Keyword search
562
static CONVERTED: Param; // Converted status
563
static APPROVED: Param; // Approval status
564
static PAGE: Param; // Page number
565
static PER_PAGE: Param; // Records per page
566
}
567
```
568
569
**Parameter Usage Example:**
570
571
```javascript
572
const { ParameterMap } = require("@zohocrm/nodejs-sdk-2.0/routes/parameter_map");
573
const { HeaderMap } = require("@zohocrm/nodejs-sdk-2.0/routes/header_map");
574
575
// Setup parameters
576
const paramMap = new ParameterMap();
577
await paramMap.add(GetRecordsParam.FIELDS, "Company,Last_Name,First_Name,Email");
578
await paramMap.add(GetRecordsParam.PER_PAGE, 200);
579
await paramMap.add(GetRecordsParam.PAGE, 1);
580
await paramMap.add(GetRecordsParam.SORT_BY, "Modified_Time");
581
await paramMap.add(GetRecordsParam.SORT_ORDER, "desc");
582
583
// Setup headers
584
const headerMap = new HeaderMap();
585
await headerMap.add(GetRecordsHeader.IF_MODIFIED_SINCE, new Date("2023-01-01T00:00:00Z"));
586
587
// Use with operation
588
const response = await recordOperations.getRecords("Leads", paramMap, headerMap);
589
```