Hello!
Is there a way that we can get a status changed date into a report not viewing by the Audit History?
Amanda
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
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:
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> { }
}
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;
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.