- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 06:50 AM
Hi,
I have created a UI action ''Create Defect' on stories. When a defect created from story is closed complete, story state should be moved to ready for testing, I have created a update and after business rule on defect to move the story to ready for testing.
(function executeRule(current, previous /*null when async*/ ) {
var story = new GlideRecord('rm_story');
story.addQuery('sys_id', current.reported_against);
story.query();
if (story.next()) {
if (current.state == '3') {
story.state = '-7';
} else if (current.state == '7') {
story.state = '-7';
}
story.update();
}
})(current, previous);
This business rule is working fine except it's creating below error message even when I move the defect to closed complete. And I'm not changing any product or project field on story.
Please assist.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 02:09 PM
Hello Sath,
It's happening because the product value that you checking is null in the story.
Instead modify the condition to check if the product value exists and then check with or conditions, something like below.
current.product && current.product.changes -
this first checks if the product exists and then checks if product's value is changed. This shouldn't give any null checks as well. You can further modify it to add more conditions per requirement.
Please mark my answer as helpful if it helped your query in anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 06:55 AM
This is not out of box behavior. Business Rules by nature are often skipped due to the Filter Conditions or Condition, so triggering an error message doesn't make any sense. Do you have another Business Rule or something that is triggering this message? Search the script field of all rules for keywords in the message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 12:37 PM
Hi @Brad Bowman , This BR "Set Product Backlog Type" is getting triggered when the story is getting updated from defect. I don't see any triggering conditions for this BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2025 05:42 AM
The other Business Rule is not getting triggered - as the message indicates, it is skipped due to the conditions, as it should be. The Business Rule is evaluated because it is on the rm_story table before insert/update, so everything here is operating as it should. You have some other Business Rule on the rm_story table, or it could be global that is generating this unhelpful 'error' message so you need to find that rule and inactivate it. As a workaround, you can try adding a line before the story.update(); to prevent any other Business Rules from running, but this is not usually what you want to happen with Business Rules.
story.setWorkflow(false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 06:41 AM
Hi @Brad Bowman It is working when I add
story.setWorkflow(false);
But couldn't figure out why this error message is getting triggered