Solved

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

  • 20 December 2023
  • 4 replies
  • 55 views

Userlevel 4
Badge +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?

icon

Best answer by Naveen Boga 20 December 2023, 16:13

View original

4 replies

Userlevel 7
Badge +4

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.!

Userlevel 7
Badge +17

@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();
        }

 

Userlevel 4
Badge +1

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!

Userlevel 7
Badge +4

Look like @Naveen Boga got lucky 😁

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