Skip to main content
Solved

Get status changed date into a report.

  • October 25, 2024
  • 3 replies
  • 79 views

Forum|alt.badge.img

Hello!

 

Is there a way that we can get a status changed date into a report not viewing by the Audit History?

 

Amanda

Best answer by jinin

Hi @apallawala21 ,

This can be achieved through customization.

Create a custom field in the table to update the date whenever the status changes from 'Open' to 'Completed.

You can include the custom field in the report.

Sample code:

  1. Add the Custom Field in the DAC Extension
    public class SOOrderExt : PXCacheExtension<SOOrder>
        {
            [PXDBDate]
            [PXUIField(DisplayName = "Status Changed Date")]
            public DateTime? UsrStatusChangedDate { get; set; }
            public abstract class usrStatusChangedDate : PX.Data.BQL.BqlDateTime.Field<usrStatusChangedDate> { }
        }

     

  2.  Implement the FieldUpdated Event Handler in the Graph Extension
    public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
        {
            protected void _(Events.FieldUpdated<SOOrder, SOOrder.status> e)
            {
                SOOrder order = e.Row;
                if (order == null) return;
    
                // Check if the status changed to "Completed"
                if (order.Status == SOOrderStatus.Completed)
                {
                    SOOrderExt orderExt = PXCache<SOOrder>.GetExtension<SOOrderExt>(order);
                    orderExt.UsrStatusChangedDate = PXTimeZoneInfo.Now;
                }
            }
        }

     

 

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

3 replies

Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+13

Hi @apallawala21 I am not sure if we can achieve this, However you can work on Business events to trigger an email when the status is changed. 


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 701 replies
  • Answer
  • October 25, 2024

Hi @apallawala21 ,

This can be achieved through customization.

Create a custom field in the table to update the date whenever the status changes from 'Open' to 'Completed.

You can include the custom field in the report.

Sample code:

  1. Add the Custom Field in the DAC Extension
    public class SOOrderExt : PXCacheExtension<SOOrder>
        {
            [PXDBDate]
            [PXUIField(DisplayName = "Status Changed Date")]
            public DateTime? UsrStatusChangedDate { get; set; }
            public abstract class usrStatusChangedDate : PX.Data.BQL.BqlDateTime.Field<usrStatusChangedDate> { }
        }

     

  2.  Implement the FieldUpdated Event Handler in the Graph Extension
    public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
        {
            protected void _(Events.FieldUpdated<SOOrder, SOOrder.status> e)
            {
                SOOrder order = e.Row;
                if (order == null) return;
    
                // Check if the status changed to "Completed"
                if (order.Status == SOOrderStatus.Completed)
                {
                    SOOrderExt orderExt = PXCache<SOOrder>.GetExtension<SOOrderExt>(order);
                    orderExt.UsrStatusChangedDate = PXTimeZoneInfo.Now;
                }
            }
        }

     

 


Forum|alt.badge.img
  • Jr Varsity III
  • 15 replies
  • October 25, 2024

@apallawala21, depending on how your environment is set up and your workflow, you could join the SOOrder table to the SOShipment and pull ConfirmedDateTime from the Shipment table. 

In our system/workflow, once a shipment is confirmed the SO status is changed to Completed. Thus, the Shipment confirmed date equals the order status to complete date.

To further this, we also have a formula to calculate order turn time and can report on our fulfillment dashboard how quickly we are getting orders filled.

Created Date and Confirmed Date

EDIT to add: the logic would be similar for a report. My reference was for a GI, however.


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