- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-18-2024 12:32 PM
One of the gripes I have heard customers make about using Strategic Portfolio Management for Agile Development is that the VTB Cards whose corresponding task is a story record do not stay in sync —in that the state of the story does not automatically update to the appropriate swim lane in the VTB board (and vice versa).
Thankfully, this can easily be solved with a business rule. The first step is understanding how each record type is associated. At the center, we have the VTB card (vtb_card). The VTB card references the story record (rm_story) as a task. The VTB board (vtb_board) is the parent of the swim lane (vtb_lane) and the VTB card references the swim lane.
Within my business rule, I am building it so that when a story record is created or updated, the corresponding VTB card will be updated so that it is in a swin lane that is mapped to that story's state (and you could do the inverse when updating a VTB card so that that update would be reflected on the story record).
Within the business rule form, set the table to 'Story' and select both 'Insert' and 'Update' on the When to run tab.
Within the Advanced tab of the business rule record, use something similar to the code below. What this is doing is looking up the VTB card that is associated to the story record currently being viewed using the sys_id of that story record (since the story is referenced in the card via the task field). From there, we are grabbing the 'state' value of the story record and using a switch statement to appropriate set the VTB card to the appropriate swim lane based on that state.
*Note: you will need to know the sys_ids of the swim lanes or add a query into your code that pulls in those swim lanes (and thus their display names) into an array that you can then reference in the switch statement.
(function executeRule(current, previous) {
// get VTB card associated with the story
var vtbCard = new GlideRecord('vtb_card');
vtbCard.get('task', current.sys_id);
// get story
var story = new GlideRecord('rm_story');
story.get(current.sys_id);
var storyState = story.getValue('state');
// update VTB lane based on the state of the story
switch (storyState) {
case '1': // To Do
vtbCard.setValue('lane','CHANGE TO SYSID OF "TO DO" lane'); //needs to be sysID of the VTB lane
break;
case '2': // Doing
vtbCard.setValue('lane','CHANGE TO SYSID OF "DOING" lane');
break;
case '3': // Done
vtbCard.setValue('lane','CHANGE TO SYSID OF "DONE" lane');
break;
default:
vtbCard.setValue('lane','CHANGE TO SYSID of DEFAULT lane');
}
vtbCard.update();
})(current, previous);