- 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 01:59 PM
Open Debug > Business Rules (Detail) and then update your record. You should be able to trace this to the exact cause through the debugger.
- 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-10-2025 06:39 AM - edited 03-10-2025 07:19 AM
Hi @Shivalika It worked after I added the above condition. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 10:25 AM
Hello @sath
It's great that it worked for you.
Kindly mark my answer as helpful and accept solution. It would be beneficial for me as well as the platform so that this thread will close.
,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 10:00 PM
Hello @sath
This has been a big thread. Kindly mark my answer as solution, it will bring clarity and also it will help move this from unsolved bucket to a solved one.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY