Question

Project Complete Action on ProjectEntry graph

  • 22 April 2022
  • 0 replies
  • 49 views

Userlevel 3
Badge +1

public PXAction<PMProject> complete;
[PXButton, PXUIField(DisplayName = "Complete Project")]
public virtual IEnumerable Complete(PXAdapter adapter)
{
if (Project.Current != null)
{
//Project can only be completed if all task are completed.
PXResultset<PMTask> res = PXSelect<PMTask, Where<PMTask.projectID, Equal<Current<PMProject.contractID>>, And<PMTask.isCompleted, Equal<False>, And<PMTask.isCancelled, Equal<False>>>>>.Select(this);
if (res.Count > 0)
{
Project.Cache.RaiseExceptionHandling<PMProject.status>(Project.Current, Project.Current.Status, new PXSetPropertyException<PMProject.status>(Messages.UncompletedTasksExist, PXErrorLevel.Error, res.Count));
throw new PXException(Messages.UncompletedTasksExist, res.Count);
}
Project.Current.IsCompleted = true;
Project.Current.ExpireDate = Accessinfo.BusinessDate;
Project.Update(Project.Current);
}
return adapter.Get();
}

I’m trying to create a custom screen/graph that will have a Complete action (like the existing Project screen) but I can’t figure out how the actual Status column is getting changed on the existing or how it is persisting after this action runs.

In my custom screen/graph I am having to explicitly call Persist() and the status code itself does not change to Completed.  I wasn’t able to step any further or find any events that are setting the status and/or calling Persist()

UPDATE: I think the answer is Workflow (which I have not delved into much)  I see there is a transition from Active to Complete.  Does this implicitly cause the status to change from the action complete trigger?  And, if so, does this also fire Persist()?


0 replies

Be the first to reply!

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