0
# Users Management
1
2
The Users Management module provides comprehensive operations for managing CRM users, including user creation, updates, role assignments, and user data retrieval.
3
4
## Capabilities
5
6
### User Operations
7
8
Primary interface for all user-related operations in Zoho CRM.
9
10
```javascript { .api }
11
/**
12
* Main operations class for CRM user management
13
*/
14
class UsersOperations {
15
/**
16
* Retrieve multiple users from the organization
17
* @param paramInstance - Optional parameters for filtering users
18
* @param headerInstance - Optional headers for request customization
19
* @returns Promise with APIResponse containing user data
20
*/
21
getUsers(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
22
23
/**
24
* Create a new user in the organization
25
* @param request - Body wrapper containing user data to create
26
* @returns Promise with APIResponse containing creation results
27
*/
28
createUser(request: BodyWrapper): Promise<APIResponse>;
29
30
/**
31
* Update an existing user
32
* @param userId - Unique identifier of the user to update
33
* @param request - Body wrapper containing updated user data
34
* @returns Promise with APIResponse containing update results
35
*/
36
updateUser(userId: string, request: BodyWrapper): Promise<APIResponse>;
37
38
/**
39
* Delete a user from the organization
40
* @param userId - Unique identifier of the user to delete
41
* @returns Promise with APIResponse containing deletion results
42
*/
43
deleteUser(userId: string): Promise<APIResponse>;
44
45
/**
46
* Get a specific user by ID
47
* @param userId - Unique identifier of the user
48
* @param paramInstance - Optional parameters for field selection
49
* @param headerInstance - Optional headers for request customization
50
* @returns Promise with APIResponse containing user data
51
*/
52
getUser(userId: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
53
}
54
```
55
56
**User Operations Example:**
57
58
```javascript
59
const { UsersOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/users_operations");
60
const { BodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/body_wrapper");
61
const { User } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/user");
62
63
// Get all users
64
const usersOperations = new UsersOperations();
65
const usersResponse = await usersOperations.getUsers();
66
67
// Get specific user
68
const userResponse = await usersOperations.getUser("123456789012345678");
69
70
// Create a new user
71
const newUser = new User();
72
newUser.setFirstName("Jane");
73
newUser.setLastName("Smith");
74
newUser.setEmail("jane.smith@company.com");
75
newUser.setRole("Sales Manager");
76
newUser.setProfile("Sales Profile");
77
78
const createWrapper = new BodyWrapper();
79
createWrapper.setUsers([newUser]);
80
81
const createResponse = await usersOperations.createUser(createWrapper);
82
83
// Update user
84
newUser.setId("123456789012345678");
85
newUser.setFirstName("Jane Updated");
86
87
const updateWrapper = new BodyWrapper();
88
updateWrapper.setUsers([newUser]);
89
90
const updateResponse = await usersOperations.updateUser("123456789012345678", updateWrapper);
91
92
// Delete user
93
const deleteResponse = await usersOperations.deleteUser("123456789012345678");
94
```
95
96
### Roles Operations
97
98
Access role definitions and permission configurations for user management.
99
100
```javascript { .api }
101
/**
102
* Operations for retrieving role information and permissions
103
*/
104
class RolesOperations {
105
/**
106
* Get all roles in the organization
107
* @returns Promise with APIResponse containing roles data
108
*/
109
getRoles(): Promise<APIResponse>;
110
111
/**
112
* Get details of a specific role
113
* @param roleId - Unique identifier of the role
114
* @returns Promise with APIResponse containing role details
115
*/
116
getRole(roleId: BigInt): Promise<APIResponse>;
117
}
118
```
119
120
**Roles Operations Example:**
121
122
```javascript
123
const { RolesOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/roles/roles_operations");
124
125
const rolesOp = new RolesOperations();
126
127
// Get all roles
128
const rolesResponse = await rolesOp.getRoles();
129
130
// Get specific role details
131
const roleResponse = await rolesOp.getRole(123456789012345678n);
132
```
133
134
### Profiles Operations
135
136
Access profile configurations that define user permissions and access levels.
137
138
```javascript { .api }
139
/**
140
* Operations for retrieving user profile configurations
141
*/
142
class ProfilesOperations {
143
/**
144
* Creates a ProfilesOperations instance with optional modification date filter
145
* @param ifModifiedSince - Optional date to filter profiles modified since
146
*/
147
constructor(ifModifiedSince?: Date);
148
149
/**
150
* Get all profiles in the organization
151
* @returns Promise with APIResponse containing profiles data
152
*/
153
getProfiles(): Promise<APIResponse>;
154
155
/**
156
* Get details of a specific profile
157
* @param profileId - Unique identifier of the profile
158
* @returns Promise with APIResponse containing profile details
159
*/
160
getProfile(profileId: BigInt): Promise<APIResponse>;
161
}
162
```
163
164
**Profiles Operations Example:**
165
166
```javascript
167
const { ProfilesOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/profiles/profiles_operations");
168
169
const profilesOp = new ProfilesOperations();
170
171
// Get all profiles
172
const profilesResponse = await profilesOp.getProfiles();
173
174
// Get specific profile details
175
const profileResponse = await profilesOp.getProfile(123456789012345678n);
176
```
177
178
### User Data Model
179
180
The core user data structure representing CRM users.
181
182
```javascript { .api }
183
/**
184
* Represents a CRM user with all user information and settings
185
*/
186
class User {
187
/** Create a new user instance */
188
constructor();
189
190
/** Get user ID */
191
getId(): string;
192
/** Set user ID */
193
setId(id: string): void;
194
195
/** Get user's first name */
196
getFirstName(): string;
197
/** Set user's first name */
198
setFirstName(firstName: string): void;
199
200
/** Get user's last name */
201
getLastName(): string;
202
/** Set user's last name */
203
setLastName(lastName: string): void;
204
205
/** Get user's full name */
206
getFullName(): string;
207
/** Set user's full name */
208
setFullName(fullName: string): void;
209
210
/** Get user's email address */
211
getEmail(): string;
212
/** Set user's email address */
213
setEmail(email: string): void;
214
215
/** Get user's phone number */
216
getPhone(): string;
217
/** Set user's phone number */
218
setPhone(phone: string): void;
219
220
/** Get user's mobile number */
221
getMobile(): string;
222
/** Set user's mobile number */
223
setMobile(mobile: string): void;
224
225
/** Get user's website */
226
getWebsite(): string;
227
/** Set user's website */
228
setWebsite(website: string): void;
229
230
/** Get user's language */
231
getLanguage(): string;
232
/** Set user's language */
233
setLanguage(language: string): void;
234
235
/** Get user's locale */
236
getLocale(): string;
237
/** Set user's locale */
238
setLocale(locale: string): void;
239
240
/** Get user's timezone */
241
getTimeZone(): string;
242
/** Set user's timezone */
243
setTimeZone(timeZone: string): void;
244
245
/** Get user's role */
246
getRole(): Role;
247
/** Set user's role */
248
setRole(role: Role): void;
249
250
/** Get user's profile */
251
getProfile(): Profile;
252
/** Set user's profile */
253
setProfile(profile: Profile): void;
254
255
/** Get user's manager */
256
getReportingTo(): User;
257
/** Set user's manager */
258
setReportingTo(reportingTo: User): void;
259
260
/** Get user's status (active/inactive) */
261
getStatus(): string;
262
/** Set user's status */
263
setStatus(status: string): void;
264
265
/** Get user's employee number */
266
getEmployee(): string;
267
/** Set user's employee number */
268
setEmployee(employee: string): void;
269
270
/** Get user creation time */
271
getCreatedTime(): Date;
272
/** Get user modification time */
273
getModifiedTime(): Date;
274
275
/** Get user who created this user */
276
getCreatedBy(): User;
277
/** Get user who last modified this user */
278
getModifiedBy(): User;
279
280
/** Check if user is online */
281
getOnline(): boolean;
282
283
/** Get user's territories */
284
getTerritories(): Territory[];
285
/** Set user's territories */
286
setTerritories(territories: Territory[]): void;
287
288
/** Get user's date format */
289
getDateFormat(): string;
290
/** Set user's date format */
291
setDateFormat(dateFormat: string): void;
292
293
/** Get user's time format */
294
getTimeFormat(): string;
295
/** Set user's time format */
296
setTimeFormat(timeFormat: string): void;
297
298
/** Get user's decimal separator */
299
getDecimalSeparator(): string;
300
/** Set user's decimal separator */
301
setDecimalSeparator(separator: string): void;
302
303
/** Get user's thousands separator */
304
getThousandSeparator(): string;
305
/** Set user's thousands separator */
306
setThousandSeparator(separator: string): void;
307
308
/** Get user's currency */
309
getCurrency(): Currency;
310
/** Set user's currency */
311
setCurrency(currency: Currency): void;
312
}
313
```
314
315
### Request/Response Wrappers
316
317
Wrapper classes for handling user API requests and responses.
318
319
```javascript { .api }
320
/**
321
* Wrapper for user request bodies
322
*/
323
class BodyWrapper {
324
/** Get user data */
325
getUsers(): User[];
326
/** Set user data */
327
setUsers(users: User[]): void;
328
}
329
330
/**
331
* Wrapper for user responses (GET operations)
332
*/
333
class ResponseWrapper {
334
/** Get user data from response */
335
getUsers(): User[];
336
/** Get pagination info */
337
getInfo(): Info;
338
}
339
340
/**
341
* Wrapper for user action responses (POST/PUT/DELETE operations)
342
*/
343
class ActionWrapper {
344
/** Get action results */
345
getUsers(): ActionResponse[];
346
}
347
```
348
349
### Query Parameters and Headers
350
351
Parameters and headers for customizing user operations.
352
353
```javascript { .api }
354
/**
355
* Parameters for getUsers operation
356
*/
357
class GetUsersParam {
358
static TYPE: Param; // User type filter (AllUsers, ActiveUsers, DeactiveUsers, ConfirmedUsers, NotConfirmedUsers)
359
static PAGE: Param; // Page number for pagination
360
static PER_PAGE: Param; // Number of users per page
361
}
362
363
/**
364
* Headers for getUsers operation
365
*/
366
class GetUsersHeader {
367
static IF_MODIFIED_SINCE: Header; // Get users modified since specified date
368
}
369
370
/**
371
* Parameters for getUser operation
372
*/
373
class GetUserParam {
374
static TYPE: Param; // User type filter
375
}
376
377
/**
378
* Headers for getUser operation
379
*/
380
class GetUserHeader {
381
static IF_MODIFIED_SINCE: Header; // Get user if modified since specified date
382
}
383
```
384
385
**Parameter Usage Example:**
386
387
```javascript
388
const { ParameterMap } = require("@zohocrm/nodejs-sdk-2.0/routes/parameter_map");
389
const { HeaderMap } = require("@zohocrm/nodejs-sdk-2.0/routes/header_map");
390
const { GetUsersParam, GetUsersHeader } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/users_operations");
391
392
// Setup parameters for getting active users
393
const paramMap = new ParameterMap();
394
await paramMap.add(GetUsersParam.TYPE, "ActiveUsers");
395
await paramMap.add(GetUsersParam.PAGE, 1);
396
await paramMap.add(GetUsersParam.PER_PAGE, 200);
397
398
// Setup headers
399
const headerMap = new HeaderMap();
400
await headerMap.add(GetUsersHeader.IF_MODIFIED_SINCE, new Date("2023-01-01T00:00:00Z"));
401
402
// Get users with filters
403
const response = await usersOperations.getUsers(paramMap, headerMap);
404
```
405
406
### Role and Profile Types
407
408
Associated types for user roles and profiles.
409
410
```javascript { .api }
411
/**
412
* Represents a user role in the CRM
413
*/
414
class Role {
415
/** Get role ID */
416
getId(): string;
417
/** Set role ID */
418
setId(id: string): void;
419
420
/** Get role name */
421
getName(): string;
422
/** Set role name */
423
setName(name: string): void;
424
425
/** Get role display label */
426
getDisplayLabel(): string;
427
/** Set role display label */
428
setDisplayLabel(displayLabel: string): void;
429
430
/** Get role forecast manager */
431
getForecastManager(): User;
432
/** Set role forecast manager */
433
setForecastManager(forecastManager: User): void;
434
435
/** Get role share with peers */
436
getShareWithPeers(): boolean;
437
/** Set role share with peers */
438
setShareWithPeers(shareWithPeers: boolean): void;
439
}
440
441
/**
442
* Represents a user profile in the CRM
443
*/
444
class Profile {
445
/** Get profile ID */
446
getId(): string;
447
/** Set profile ID */
448
setId(id: string): void;
449
450
/** Get profile name */
451
getName(): string;
452
/** Set profile name */
453
setName(name: string): void;
454
455
/** Get profile category */
456
getCategory(): string;
457
/** Set profile category */
458
setCategory(category: string): void;
459
460
/** Get profile description */
461
getDescription(): string;
462
/** Set profile description */
463
setDescription(description: string): void;
464
}
465
466
/**
467
* Represents a territory assignment
468
*/
469
class Territory {
470
/** Get territory ID */
471
getId(): string;
472
/** Set territory ID */
473
setId(id: string): void;
474
475
/** Get territory name */
476
getName(): string;
477
/** Set territory name */
478
setName(name: string): void;
479
480
/** Get territory manager */
481
getManager(): User;
482
/** Set territory manager */
483
setManager(manager: User): void;
484
}
485
486
/**
487
* Represents currency information
488
*/
489
class Currency {
490
/** Get currency ID */
491
getId(): string;
492
/** Set currency ID */
493
setId(id: string): void;
494
495
/** Get ISO code */
496
getIsoCode(): string;
497
/** Set ISO code */
498
setIsoCode(isoCode: string): void;
499
500
/** Get currency symbol */
501
getSymbol(): string;
502
/** Set currency symbol */
503
setSymbol(symbol: string): void;
504
505
/** Get creation time */
506
getCreatedTime(): Date;
507
/** Get modification time */
508
getModifiedTime(): Date;
509
510
/** Check if base currency */
511
getIsBase(): boolean;
512
/** Set base currency flag */
513
setIsBase(isBase: boolean): void;
514
515
/** Get exchange rate */
516
getExchangeRate(): number;
517
/** Set exchange rate */
518
setExchangeRate(exchangeRate: number): void;
519
}
520
```
521
522
### User Status Constants
523
524
Common user status values and types.
525
526
```javascript { .api }
527
/**
528
* User status constants
529
*/
530
class UserStatus {
531
static ACTIVE: string = "active";
532
static INACTIVE: string = "inactive";
533
static DELETED: string = "deleted";
534
}
535
536
/**
537
* User type constants for filtering
538
*/
539
class UserType {
540
static ALL_USERS: string = "AllUsers";
541
static ACTIVE_USERS: string = "ActiveUsers";
542
static DEACTIVE_USERS: string = "DeactiveUsers";
543
static CONFIRMED_USERS: string = "ConfirmedUsers";
544
static NOT_CONFIRMED_USERS: string = "NotConfirmedUsers";
545
}
546
```