Skip to content

Commit 1baacb4

Browse files
authored
Add bulk users to a Visual task Board (#1503)
* Create addBulkUsersToVTB.js * readme.md
1 parent aa384d5 commit 1baacb4

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Fix scripts/addBulkUsersToVTB.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Replace with the sys_id of the Visual Task Board you want to add users to
2+
var boardSysId = 'sys_id_of_board';
3+
4+
// Replace with sys_ids of different users to be added to VTB
5+
var userSysIds = ['user_1','user_2','user_3'];
6+
7+
var board = new GlideRecord('vtb_board');
8+
if (!board.get(boardSysId))
9+
{
10+
gs.addErrorMessage("This Visual Task Board does not exist.");
11+
}
12+
13+
else
14+
{
15+
var addedCount = 0;
16+
userSysIds.forEach(function(userId)
17+
{
18+
var boardMember = new GlideRecord('vtb_board_member');
19+
boardMember.initialize();
20+
boardMember.board = boardSysId;
21+
boardMember.user = userId;
22+
boardMember.insert();
23+
addedCount++;
24+
});
25+
gs.addInfoMessage(addedCount + " users have been successfully added to your Visual Task Board: " + board.getValue('name'));
26+
}

Fix scripts/readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
For the teams who are using large number of VTBs on a daily basis based on multiple categories, for them adding multiple users to a Visual Task Board (VTB) manually is a tedious task.
2+
To solve this, we can use a Fix Script to automate the process.
3+
Visual Task Boards are stored in the vtb_board table, and board members are linked through the vtb_board_member table.
4+
This script will allow us to add multiple users to a specific board by querying and inserting them as board members.
5+
6+
Explanation
7+
- Set the boardSysId variable to the sys_id of the Visual Task Board to which you want to add users.
8+
- Add the sys_id values of the users you want to add to the board in the userSysIds array.
9+
- The script checks if the board with the specified boardSysId exists in the vtb_board table. If it doesn’t, it will display an error message.
10+
- After adding all users, the script displays a message with the total number of users added to the board.

0 commit comments

Comments
 (0)