- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 06:05 AM
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
Solved! Go to Solution.
- Labels:
-
Agile Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 07:58 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 07:55 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 07:58 AM
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.