How can I change the project state from " closed completed" to " work in progress" ?

Dan122
Tera Contributor

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"? 

1 ACCEPTED SOLUTION

Dhiren Aghera
Tera Guru

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.

View solution in original post

3 REPLIES 3

shivangi k
Kilo Sage

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,

Dhiren Aghera
Tera Guru

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.

Amit Gujarathi
Giga Sage
Giga Sage

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