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
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
Best answer by aaghaei
Hi
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;
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.