Skip to main content
Solved

Creating a record in a different graph when saving a sales order

  • December 20, 2023
  • 4 replies
  • 125 views

Forum|alt.badge.img+1

The Sales Quotes screen has an option to ‘Convert To Order’. This option pops up the screen below and when you click Create And Review, the system creates a sales order based on the sales quote and uses ‘throw new PXRedirectRequiredException(docgraph, "");’ to direct the user to the sales order screen.

Below is the sales orders screen, the important point is that the sales order has not been saved to the database at this point. The user has to click save to persist the info to the database.

At the point of saving the sales order I want to create a purchase order (I won’t explain why). 
It’s important that the purchase order isn’t created unless the sales order is saved. 

I was going to create a POOrderEntry graph in the RowPersisting event but this results in error PX1045, as shown below.

 

I cannot figure out where I can place my code in the SOEntry graph without the use of an event, which isn’t allowed. 

I wondered whether the call of PXRedirectRequiredException might provide a method I could override, but since this is called from the QuoteMaint page I don’t think it’s an option.

Can anyone advise how I can implement this requirement?

Best answer by Naveen Boga

@stephenward03  You can write in Persist Delegate like below.

 public delegate void PersistDelegate();
        [PXOverride]
        public void Persist(PersistDelegate del)
        {

            POOrderEntry POEntry = PXGraph.CreateInstance<POOrderEntry>();
            //LOGIC HERE

            del();
        }

 

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

4 replies

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi @stephenward03,

Instead, you can try overriding PersistImpl in SOOrderEntry, create PO then invoke the base.

Below is an code you can try in SOOrderEntry

    public delegate void PersistImplDelegate();
    [PXOverride]
    public void PersistImpl(PersistImplDelegate baseMethod)
    {

      //Create PO as required
      baseMethod();
    }

Hope that helps, good luck.!


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • Answer
  • December 20, 2023

@stephenward03  You can write in Persist Delegate like below.

 public delegate void PersistDelegate();
        [PXOverride]
        public void Persist(PersistDelegate del)
        {

            POOrderEntry POEntry = PXGraph.CreateInstance<POOrderEntry>();
            //LOGIC HERE

            del();
        }

 


Forum|alt.badge.img+1
  • Author
  • Varsity I
  • 93 replies
  • December 20, 2023

Both answers work. Thanks for your help, I only wish I’d asked earlier!

I don’t know how to pick a ‘Best answer’, I’ll flip a coin!


Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Look like @Naveen Boga got lucky 😁


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