Skip to main content
Solved

Cache not persisted until after action completes

  • November 10, 2022
  • 4 replies
  • 105 views

Forum|alt.badge.img+1
  • Varsity I
  • 50 replies

During or shortly after the Release action for a ChangeOrder I would like to perform additional updates to the related Project. However, I am not sure how to do this in a way where the Release action is full persisted before continuing.  

Below I have attempted to handle the standard release action (Base.Release), and then tag on a function call (SetCurrentOrderSet) to update the project, however since the Release action has not been persisted my logic in SetCurrentOrderSet fails.

public class ChangeOrderEntry_Ext : PXGraphExtension<ChangeOrderEntry>
{  
      public PXAction<PMChangeOrder> release;

        [PXUIField(DisplayName = "Release")]
        [PXProcessButton]
        public virtual IEnumerable Release(PXAdapter adapter)
        {
            var result = Base.Release(adapter);              

            PMProject prj = this.Base.Project.Current;

            ProjectEntry prjGraph = PXGraph.CreateInstance<ProjectEntry>();
            ProjectEntry_Extension prjGraph_Ext = prjGraph.GetExtension<ProjectEntry_Extension>();

            prjGraph_Ext.SetCurrentOrderSet(prj);


            return result;
        }
}

I have tried to use the RowPersited event to call SetCurrentOrderSet but am unable to initialize a graph inside the function without error.

How could I better handle this logic?

Best answer by Leif

Seems the cache was dirty, and adding ReadOnly to SelectFrom<> solved my issues.

Thanks 

View original
Did this topic help you find an answer to your question?

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3393 replies
  • November 10, 2022

Hi @Leif  As you are invoking the Base.Release(adapter) action beginning of the code, and once the document is released, then the document is moved to read-only mode, and the system will not allow any changes to this document.

 


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • 50 replies
  • November 10, 2022

Thanks @Naveen Boga  for the reply.

I am not trying to update the ChangeOrder document after Base.Release. I am trying to update the parent project, but to do so I need to query the list of change orders. However, when I make the query, I show the newly released CO not to actually be released. However, once the action completes the database is updated.


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • 50 replies
  • Answer
  • November 14, 2022

Seems the cache was dirty, and adding ReadOnly to SelectFrom<> solved my issues.

Thanks 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2749 replies
  • November 18, 2022

Hi @Leif - thank you for sharing your solution with the community!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings