I have a custom selector created in the sales order line as below, which is a selector that filters the values from a custom table based on the UOM selected on the sales order line. (UOM selected filters the corresponding matching WeightUOM field in the custom table and displays selector values)
[PXDBString(500, IsUnicode = true)]
[PXSelector(
typeof(Search<MWTPackagingOptions.packageDescription>),
typeof(MWTPackagingOptions.packageDescription),
typeof(MWTPackagingOptions.weightUOM),
DescriptionField = typeof(MWTPackagingOptions.packageDescription)
)]
[PXRestrictor(
typeof(Where<MWTPackagingOptions.weightUOM, Equal<Current<SOLine.uOM>>>),
"The selected packaging option is not valid for the UOM on this sales order line."
)]
[PXUIField(DisplayName = "Package Type")]
This works but if I update the UOM how can I ensure the selector is automatically refreshed without having to manually click the refresh button in the selector to extract the results? I have tried a fieldupdated for UOM but it does not do any changes.
protected void SOLine_UOM_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
// Invoke the base handler if it exists (this is equivalent to calling base.<EventMethod> in other cases)
InvokeBaseHandler?.Invoke(cache, e);
SOLine row = (SOLine)e.Row;
if (row != null)
{
// Custom logic after the base handler
cache.SetValueExt<SOLineExt.usrCustomPackageType>(row, null);
// Force re-fetch of data in selector
cache.RaiseFieldUpdated<SOLineExt.usrCustomPackageType>(row, null);
}
}
Any help would be appreciated, thank you!