Question

How to include a custom filter field in a processing screen's filtering function

  • 28 March 2024
  • 0 replies
  • 25 views

Userlevel 4
Badge

Hi,

A client is wanting to add an Operation field to the Process Shipments screen and have it change the results in the grid when the value changes, like the other fields in this screen.

Below is the code I have added to the Graph Extension, but it is not working, so I guess I am going about it the wrong way.

What would you suggest I do to ensure this new custom field is included in the filtering function?

Let me know if you need any other information.

Kind regards,

Andrew

 

Operation field highlighted above

 

This is the graph extension for trying to include the Operation field in the filter functions.

public class SOInvoiceShipment_Extension : PXGraphExtension<PX.Objects.SO.SOInvoiceShipment>
{
#region Event Handlers
public delegate void ApplyReceiptFiltersDelegate(PXSelectBase<POReceipt> rtCmd, SOShipmentFilter filter);
[PXOverride]
public void ApplyReceiptFilters(PXSelectBase<POReceipt> rtCmd, SOShipmentFilter filter, ApplyReceiptFiltersDelegate baseMethod)
{
if (filter != null)
{
// Apply existing filters
baseMethod(rtCmd, filter);

// Apply additional filters based on your custom field
SOShipmentFilterExt filterExt = filter.GetExtension<SOShipmentFilterExt>();
if (!string.IsNullOrEmpty(filterExt.UsrOperation))
{
rtCmd.WhereAnd<Where<SOShipment.operation, Equal<Current<SOShipmentFilterExt.usrOperation>>>>();
}
}
else
{
baseMethod(rtCmd, filter);
}
}

public delegate void ApplyShipmentFiltersDelegate(PXSelectBase<SOShipment> shCmd, SOShipmentFilter filter);
[PXOverride]
public void ApplyShipmentFilters(PXSelectBase<SOShipment> shCmd, SOShipmentFilter filter, ApplyShipmentFiltersDelegate baseMethod)
{
if (filter != null)
{
// Apply existing filters
baseMethod(shCmd, filter);

// Apply additional filters based on your custom field
SOShipmentFilterExt filterExt = filter.GetExtension<SOShipmentFilterExt>();
if (!string.IsNullOrEmpty(filterExt.UsrOperation))
{
shCmd.WhereAnd<Where<SOShipment.operation, Equal<Current<SOShipmentFilterExt.usrOperation>>>>();
}
}
else
{
baseMethod(shCmd, filter);
}
}



#endregion
}

 

This is the definition for this new Operation field.

public class SOShipmentFilterExt : PXCacheExtension<PX.Objects.SO.SOShipmentFilter>
{
#region UsrCustomField
[PXString]
[PXUIField(DisplayName = "Operation")]
[SOOperation.List]
public virtual string UsrOperation { get; set; }
public abstract class usrOperation : PX.Data.BQL.BqlString.Field<usrOperation> { }
#endregion
}

 


0 replies

Be the first to reply!

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