Skip to main content

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
}

 

Be the first to reply!

Reply