Standard change state transition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 08:18 PM
Hi Team,
Although I created record for state transition from implement to review, with condition script which check if there are no active tasks and also checked 'automatic transition'.
But when I close all tasks in implement state, still change is stuck in implement state only.
This is happening only to standard change, for other types of changes it is working fine.
I have compared state models and state transition records of other types of changes, its similar.
Any ways to debug ?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 10:35 PM
HI @rambo1 ,
I trust you are doing great.
To debug the issue where the state transition from "Implement" to "Review" is not occurring even after closing all tasks, follow these steps:
Verify State Models: Ensure that the state models for both standard changes and other types of changes are indeed similar. Compare the state model configurations to confirm that there are no discrepancies.
Validate Transition Condition Script: Double-check the condition script associated with the state transition from "Implement" to "Review". Make sure the script accurately checks for the absence of active tasks and confirms the "Automatic Transition" option is selected. You can review the script code as follows:
// Condition script for the state transition from "Implement" to "Review"
// Make sure this script checks for no active tasks and automatic transition
Check Active Tasks: Review the tasks associated with the standard change in the "Implement" state. Ensure that all tasks are closed and no active tasks remain. You can use the following ServiceNow query to validate this:
var gr = new GlideRecord('task');
gr.addQuery('change_request', '<standard_change_sys_id>');
gr.addQuery('active', true);
gr.query();
if (gr.hasNext()) {
// There are still active tasks associated with the standard change
} else {
// All tasks are closed for the standard change
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 10:39 PM
Hi Amit,
I checked all those with other types of changes , it is similar.
I also deleted state transition records and recreated and copied same code from other change types.