Solved

Is there a way to update a custom field in the Customer record when the status of a Sales Order changes to Completed?

  • 22 January 2022
  • 8 replies
  • 501 views

Userlevel 5
Badge +1

We need to record somewhere the most recent completed order date for a customer so we can report later on how recently a customer made an order.  Is there any way to do this automatically when changing status to Completed on the Sales Order? The field we want to update is on the Customer record. Is this something that can be done using a Customization?

icon

Best answer by KishoK 24 January 2022, 10:30

View original

8 replies

Userlevel 2
Badge +1

This looks like it will be a good use of the new workflow engine.  

Userlevel 2

I couldn’t post the answer . So attached as a file

Userlevel 4
Badge +1

hi @ppowell,  the standard acumatica Business Accounts screen shows the orders, placed by this customer. 

You can either use the same screen or create a GI or reports based on this. 

If your particular looking for customer screen, custom field only to show the last completed order then it has to customized. Let me know if you need help on the approach for customization.

 

 

Userlevel 5
Badge +1

I couldn’t post the answer . So attached as a file

Thanks so much.  I’ll have a look at this and see if it does what we need.  It’s useful to see some code so I can at least get an idea of how things work with this. Really appreciate your help.

Userlevel 5
Badge +1

hi @ppowell,  the standard acumatica Business Accounts screen shows the orders, placed by this customer. 

You can either use the same screen or create a GI or reports based on this. 

If your particular looking for customer screen, custom field only to show the last completed order then it has to customized. Let me know if you need help on the approach for customization.

 

 

Unfortunately what we need is a single entry showing the most recent order date for each customer (so max(Order.OrderDate)) for completed SO or WO orders. This is because we have to report on how many customers has their most recent order in each month.  A GI doesn’t seem to have a way to group by Max(SOOrder.OrderDate) as well as count the customers in a given month. As we don't seem to be able to do it as a GI I decided the best option is to record the most recent order date somewhere when we complete the order which then gives us a single entry per customer and I can group by that date instead.

 

Thanks for your input

 

 

Userlevel 5
Badge +1

This looks like it will be a good use of the new workflow engine.  

I’ll have to look into the workflow engine.  I’m pretty new to Acumatica and still learning what is possible and what isn’t and the best way to achieve the results we desire.

 

Thanks for your input

Userlevel 3
Badge

I couldn’t post the answer . So attached as a file

We have used this method as well - over-riding the Persist on the Sales order is the best way to update the user field on the Customer

Userlevel 4
Badge +1

hi @ppowell,  the standard acumatica Business Accounts screen shows the orders, placed by this customer. 

You can either use the same screen or create a GI or reports based on this. 

If your particular looking for customer screen, custom field only to show the last completed order then it has to customized. Let me know if you need help on the approach for customization.

 

 

Unfortunately what we need is a single entry showing the most recent order date for each customer (so max(Order.OrderDate)) for completed SO or WO orders. This is because we have to report on how many customers has their most recent order in each month.  A GI doesn’t seem to have a way to group by Max(SOOrder.OrderDate) as well as count the customers in a given month. As we don't seem to be able to do it as a GI I decided the best option is to record the most recent order date somewhere when we complete the order which then gives us a single entry per customer and I can group by that date instead.

 

Thanks for your input

 

 

hi @ppowell 

Below event / logic will help you to build the logic to update the sales order count. 

  protected virtual void SOOrder_RowPersisted(PXCache sender, PXRowPersistedEventArgs e, PXRowPersisted baseEvent)
        {

            baseEvent?.Invoke(sender, e);
            SOOrder row = (SOOrder)e.Row;
            if (row == null)
            {
                return;
            }

            if (e.TranStatus == PXTranStatus.Completed && row.Status == SOOrderStatus.Completed)
            {
                 // You can build logic here based on to update the count of the customer ID and additional filter if required.              
                
            }     

        }

Let me know this helps. 

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