Agile development Story dependency & prerequisite

Claudia Der
Giga Contributor

I have two agile stories and one of them is a prerequisite to the other. I need to avoid starting to work with the prerequisite story until the first one is completed. For that reason, I would like to do something to nobody changing the state story to work in progress when it has a prerequisite story not completed.

Is there any business rule or UI action that can manage this condition?

Best regards,

Claudia

1 ACCEPTED SOLUTION

James-B
Kilo Sage

There are quite a few ways to skin this cat by the way but I like this one because it allows the user to try and prompts them that there is an issue they need to resolve before they can perform the action. 

View solution in original post

2 REPLIES 2

James-B
Kilo Sage

This attached BR should help you.

It will abort the action and display an error message saying there are active prereqs.

 

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

	var id = current.getUniqueValue();
	var verify = false;
	var prq = new GlideRecord('m2m_story_dependencies');
	prq.addQuery('dependent_story.sys_id', id);
	prq.addQuery('prerequisite_story.state','!=', '3');
	prq.query();
	
	if (prq.next()){
		verify = true;
	}		
	
	if (verify === true){
		gs.addErrorMessage('This story has an active prerequisite story.');		
		current.setAbortAction(true);
	}

})(current, previous);

 

Please mark my answer as correct if this resolved your issue. 

James-B
Kilo Sage

There are quite a few ways to skin this cat by the way but I like this one because it allows the user to try and prompts them that there is an issue they need to resolve before they can perform the action.