How to edit STRY pop up

Leslie2
Tera Contributor

In Agile Board, when in the current sprint and you select a story, a pop-up appears with the ability to label, assign, add attachments, and checklist. 

I am trying to find a way to auto-add check-list items as we will always have a core set of items. 

2 REPLIES 2

Gurpreet07
Mega Sage

When you add a new checklist for a story then system add a record in 'checklist' table and related items added to 'checklist_item' table. checklist table has a document_id field and so this can be linked to any table records in servicenow.

So basically you need an insert business rule on story table to insert a record in checklist table and prebuild list of checks into checklist_item table.

Tai Vu
Kilo Patron
Kilo Patron

Hi @Leslie2 

Let's try the below After Insert Business Rule in the Story [rm_story] table.

(function executeRule(current, previous /*null when async*/ ) {

    var grChecklist = new GlideRecord('checklist');
    grChecklist.initialize();
    grChecklist.table = current.getTableName();
    grChecklist.document = current.getUniqueValue();
    grChecklist.owner = gs.getUserID();
    grChecklist.name = 'Story Checklist'; //replace your own checklist name
    var checklistID = grChecklist.insert();
    if (!gs.nil(checklistID)) {
        var arrItem = ['Implementation', 'Unit Test', 'Peer Review', 'Mark Complete']; //replace your own checklist items
		for (var i in arrItem){
			generateChecklistItem(arrItem[i], checklistID);
		}
    }

	function generateChecklistItem(item_name, checklist_id){
		var grItem = new GlideRecord('checklist_item');
		grItem.initialize();
		grItem.checklist = checklist_id;
		grItem.name = item_name;
		grItem.insert();
	}


})(current, previous);

 

Let me know if it works for you.

 

Cheers,

Tai Vu