- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 02:05 AM
Project manager wrongly closed all the project tasks before project task completed. This cause the project state changed from "Work in progress" to "closed completed".
How can we change back the project state to "work in progress"?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 10:12 PM
Hi @Dan122
You can go to the planning console of that project and change the state of the tasks from complete to work in progress and the project state should change back from Closed complete to Work in progress.
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 05:09 AM - edited 02-22-2023 05:10 AM
Hi @Dan122
var pj= new GlideRecord("pm_project_task");
pj.addQuery('state', 3); //project tasks with closed state
while(pj.next()){
pj.parent.state = '2'; //project state for WIP
pj.setWorkflow(false);
pj.update();
}
Use this code in background script.
Please mark helpful and accept solution if it helped you.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 10:12 PM
Hi @Dan122
You can go to the planning console of that project and change the state of the tasks from complete to work in progress and the project state should change back from Closed complete to Work in progress.
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 10:20 PM
HI @Dan122 ,
I trust you are doing great.
Please find the below code with some modifications to shivangi code to make it right.
// Get all project tasks with a closed state
var projectTasksGR = new GlideRecord("pm_project_task");
projectTasksGR.addQuery("state", 3);
// Disable the workflow on the project task record
projectTasksGR.setWorkflow(false);
projectTasks.query();
// Loop through each project task record
while (projectTasksGR.next()) {
// Update the parent project's state to "Work in Progress"
var parentProjectGR = projectTasksGR.parent;
parentProjectGR.state = "2";
// Update the project task record
projectTasksGR.update();
}
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Amit Gujarathi
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi