Clone Visual Task Board
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 08:45 AM
how can i clone my task board? for example, i have a task board of change requests for Applications team and I'd like to be able to clone that list for the Infrastructure team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2017 08:31 PM
ISorry but there is no way within a Visual Task Board itself to clone it, But, you can do this on the form itself (the vtb_board table) by creating a UI Action to do the clone, including the respective lanes (vtb_lane). I quickly hacked together a sample Script Include as a proof of concept which I have attached.
You can then create the UI Action and call the utility with a script like:
- // Clone the board
- var originalBoard = current.name;
- var clonedBoard = (new VTBCloneUtil()).cloneBoard(current);
- // Redirect to the new board
- action.setRedirectURL(clonedBoard);
- gs.addInfoMessage(gs.getMessage("Cloned from {0} board", originalBoard));
I hope this helps you achieve your requirements
Regards, Aditya Telidevara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 06:33 AM
Did this also clone the members within that board or just the board/lanes itself?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 07:14 AM
I tried this in my instance and was not able to make it work properly-can you walk me through the set up?
Thanks!
Heather
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 06:16 AM
Not sure if I'm too late but here's a script that may help.
Use case is creating a VTB from an incident record. It assumes you've got an existing board called 'Major Incident VTB' (change bold text below to the board you want to copy)
UI Action:
Name: Create VTB
Script:
//copy board named 'Major Incident VTB'
var clonedBoard = doClone("Major Incident VTB");
//launch new board
action.setRedirectURL("$vtb.do?sysparm_board=" + clonedBoard.sys_id);
function doClone(boardName){
//find board and insert copy
var vtb = new GlideRecord('vtb_board');
vtb.addEncodedQuery('name=' + boardName);
vtb.query();
if(vtb.next()){
var origId = vtb.sys_id.toString();
var newBoard = vtb;
//append incident number to board name
newBoard.name = boardName + ' [' + current.number + ']';
//activate board
newBoard.active = true;
var newBoardId = vtb.insert();
//find all lanes associated with original board and insert copies that point to new board
var gr = new GlideRecord('vtb_lane');
gr.addEncodedQuery('board=' + origId);
gr.query();
while(gr.next()){
var newLane = gr;
newLane.board = newBoardId;
var newLaneId = gr.insert();
}
//copy the cards
var cards = new GlideRecord('vtb_card');
cards.addEncodedQuery('board=' + origId);
cards.query();
while(cards.next()){
var taskId = generateNewPrivateTask(cards.task.short_description);
var laneId = findLane(cards.lane.getDisplayValue(),newBoardId);
var newCards = cards;
newCards.board = newBoardId;
newCards.task = taskId;
newCards.lane = laneId;
var newCardId = cards.insert();
}
//copy members
var mems = new GlideRecord('vtb_board_member');
mems.addEncodedQuery('board=' + origId);
mems.query();
while(mems.next()){
var newMems = mems;
newMems.board = newBoardId;
var nowMemsId = mems.insert();
}
return newBoard;
}
return current;
}
function findLane(card,newBoard){
var gr = new GlideRecord('vtb_lane');
gr.addEncodedQuery('board=' + newBoard + '^name=' + card);
gr.query();
if(gr.next()){
return gr.sys_id;
}
}
function generateNewPrivateTask(sd){
var gr = new GlideRecord('vtb_task');
gr.initialize();
gr.short_description = sd;
var taskId = gr.insert();
return taskId;
}