Solved

Project Task End Date


Userlevel 3
Badge

Hello all, We have many tasks on our projects. They get completed, but not always on the day the work was done. I can set the end date, but when using the Complete button it updates the date to current. Is there a way around this?  

 

Thank you

icon

Best answer by aaghaei 7 June 2024, 16:59

View original

11 replies

Userlevel 7
Badge +9

Hi @keithschm 

What you are experiencing is irrelevent to the “Complete” button. even if you update the task status for each task in the task grid you will experience the same. The reason is the FieldUpdated event handler on Status field. I had a look at the code and there is no switch in Project references or anywhere else to alter this behaviour. See the below snippet from Acumatica standard code. as you can see in the completed status the EndDate (Task Completion Date) is anyway updated to the current business date.

 

The only option you have is a customization that overrides this handler like this assuming you can use customization editor or some coding otherwise you need to have someone with a little bit more technicality do it for you.

protected virtual void _(Events.FieldUpdated<PMTask, PMTask.status> e, PXFieldUpdated baseHandler)
{
if (e.Row == null) return;

var endDate = e.Row.EndDate;
baseHandler?.Invoke(e.Cache, e.Args);
if ((string)e.NewValue == ProjectTaskStatus.Completed && endDate != null)
{
e.Row.EndDate = endDate;
}
}

 

Userlevel 3
Badge

Thank you for this.   So if I set Status to Complete, Set the % to 100 and set the End Date say Via an API , that the same as what the Button is doing?

 

 

Userlevel 7
Badge +9

That is correct. Setting the completed % to 100 is not really required but that will keep it clean.

Userlevel 3
Badge

Thank you so much

Userlevel 3
Badge

FYI, no mater what, once you change the status to Complete on the task line or through the API it changes the date. If I set the date first it will set it correctly. But once the status is changed to Completed it updates the date to current. What is odd is through the UI I can change the date after it is completed, but not through the API.  I had to extend the API as the enddate filed was not there.

 

Is this Normal?

Userlevel 7
Badge +9

Yes it’s pretty normal. It is what FieldUpdated does unless in the handler code API calls are excluded.

you can possibly do one get and two post. Get the value and store, then update the status and let platform do what it does and finally only update the EndDate with your stored value and post it. It should do the trick

Userlevel 3
Badge

Thank you, I did try that, but no matter what. Once it is Completed the Enddate will not update with the API.  I need to complete and set the date at the same time. Would be fine with 2 calls if that would work, but I am not able to update it after it is completed through the API

Userlevel 7
Badge +9

Why don’t you add that piece of code I provided to the ProjectEntry graph extension. It will do the work for sure.

Userlevel 3
Badge

Not sure why this work, but it does…

 

 

Userlevel 7
Badge +9

Happy to see it is working @keithschm 

Userlevel 3
Badge

Thank you for all your help!!!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved