Project State Closed/Complete/Incomplete Changes Percentage Complete to 100%

Kevin21
Tera Contributor

Fuji

When a project manager changes the project state to any of the Closed states (Closed Complete, Closed Incomplete, Closed Skipped) the project percentage complete changes to 100% as a result of all of the Project tasks being changes to 100%.  

We would like to preserve the state of the project tasks and reflect the actual % complete.   We may close a project incomplete at 83% and always want to be able to see the actual % complete.

Can anyone provide any guidance?

Thanks,

Kevin

1 ACCEPTED SOLUTION

kevind16



Yes that is how we have designed the system.


But looks like this is a very small customization you can make from your end.



The code which does this is the Business Rule "Process State Change" on pm_project table.



In that code towards the end you will see the following lines




if (current.active.changesTo(false) ) {


              gs.info("Task has been closed");


              if( current.top_task == current.sys_id ){


                      if(projectAction) {


                              current.percent_complete = 100;


                              gs.info("Closing the Children with Current State: " + current.state);


                              PlannedTaskUtilsV2.closeChildren(current,current.state);


                      }


              }else if (!projectAction && ((origSysId == current.sys_id) || current.rollup)){


                      if (!current.rollup)


                              current.percent_complete = 100;


                      gs.info("Starting the Successors - State: " + openState);


                      // start successor tasks


                      PlannedTaskUtilsV2.startSuccessors(current,PlannedTaskStateUtil.OPEN_STATES);


                      gs.info("Setting the Parent State: " + closeState);


                      // check parent for close dependencies


                      PlannedTaskUtilsV2.setParentState(current);


              }


      }




Over here the code I have shown in bold text is the one which sets Project to 100% when it becomes inactive.


Probably over there you can do a simple check and update the same like this



if ( current.state == 3 )


    current.percent_complete = 100;



In the above piece of code I am setting percent complete only state is 3 (which is Closed Complete), else it will retain the current value.



Hope this helps


View solution in original post

4 REPLIES 4

kellykaufmann
Mega Guru

Hi Kevin - were you able to find a solution for this yet?


Hi Kelly,



Unfortunately not, my SN partner told me that was as designed.   Seems like something that should be configurable but haven't found the solution just yet.   Right now I have the team refraining from closing out projects that are not 100% complete until I can find one.



Thanks,


Kevin


kevind16



Yes that is how we have designed the system.


But looks like this is a very small customization you can make from your end.



The code which does this is the Business Rule "Process State Change" on pm_project table.



In that code towards the end you will see the following lines




if (current.active.changesTo(false) ) {


              gs.info("Task has been closed");


              if( current.top_task == current.sys_id ){


                      if(projectAction) {


                              current.percent_complete = 100;


                              gs.info("Closing the Children with Current State: " + current.state);


                              PlannedTaskUtilsV2.closeChildren(current,current.state);


                      }


              }else if (!projectAction && ((origSysId == current.sys_id) || current.rollup)){


                      if (!current.rollup)


                              current.percent_complete = 100;


                      gs.info("Starting the Successors - State: " + openState);


                      // start successor tasks


                      PlannedTaskUtilsV2.startSuccessors(current,PlannedTaskStateUtil.OPEN_STATES);


                      gs.info("Setting the Parent State: " + closeState);


                      // check parent for close dependencies


                      PlannedTaskUtilsV2.setParentState(current);


              }


      }




Over here the code I have shown in bold text is the one which sets Project to 100% when it becomes inactive.


Probably over there you can do a simple check and update the same like this



if ( current.state == 3 )


    current.percent_complete = 100;



In the above piece of code I am setting percent complete only state is 3 (which is Closed Complete), else it will retain the current value.



Hope this helps


Could you please help with the code in updated version of above code seems to be old