- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 06:40 AM
Hi,
I am looking for a way to clone a task ticket (PTSK) created from a visual task board free form board to the incident table. The only issue I am running into is not knowing how to transfer Visual Task Board card item checklists with the transfer. I am running the current script below as a fixed script.
var vtb = new GlideRecord('vtb_card');
vtb.addQuery('board', '3e0522964ff5e200d6499ffd0210c700');
vtb.addQuery('lane', 'bfaa25fa4fdb6200d6499ffd0210c704');
vtb.query();
while(vtb.next()){
var inc = new GlideRecord('incident');
inc.caller_id = vtb.task.opened_by;
inc.assigned_to = vtb.task.owner;
inc.state = vtb.task.state;
inc.short_description = vtb.task.short_description;
inc.description = vtb.task.description;
inc.category = 'applications';
inc.subcategory = 'agile';
inc.assignment_group = 'b63e45db0f3a9600f2ababf8b1050e57';
inc.contact_type = 'self-service';
var note = vtb.task.comments.getDisplayValue();
var work = vtb.task.work_notes.getDisplayValue();
inc.work_notes += note;
inc.comments += work;
var sysId = inc.insert();
}
The end goal is to take about 200 Private Tasks from a VTB board and convert them to incidents - including the checklist items and their statuses (checked / unchecked).
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 08:30 AM
Try throwing this in after line 24:
//grab checklist
var chkLst = new GlideRecord('checklist');
chkLst.addQuery('document',vtb.task.sys_id);
chkLst.query();
while(chkLst.next()){
chkLst.table = 'incident'
chkLst.document = inc.sys_id;
chkLst.update()
}
Disclaimer: This moves the Checklist and it's related items to the new incident. It does not copy.
Copying would be easily accomplishable using similar methods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 08:30 AM
Try throwing this in after line 24:
//grab checklist
var chkLst = new GlideRecord('checklist');
chkLst.addQuery('document',vtb.task.sys_id);
chkLst.query();
while(chkLst.next()){
chkLst.table = 'incident'
chkLst.document = inc.sys_id;
chkLst.update()
}
Disclaimer: This moves the Checklist and it's related items to the new incident. It does not copy.
Copying would be easily accomplishable using similar methods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 09:11 AM
Hi Matthew,
That seems to have done a good portion of what I'm trying to accomplish. It takes the checklist items from the PTSK and transfers it to the incident, however when promoting an incident to a new VTB the task items do not follow. Am I going about this wrong?
Would it make sense to run the initial clone, promote the new incidents to a task board, and then run your provided script to transfer the PTSK checklist items to the new vtb_card items? (If that makes sense).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 09:55 AM
What exactly do you mean when you say 'promoting an incident to a new VTB'? Are you simply viewing the incidents in a flexible or guided board?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2017 05:31 PM
Sorry you can disregard my last message. The first attempt didn't work as the PTSKs I was working with didn't have checklist items..
Thanks!