I have created two unbound fields on the Create Transfer Orders screen (SO509000). This screen defaults to showing the Purchasing QTY and UOM. The customer wants to also see the “Sales” QTY and UOM on the screen.
The screen works as I desired. Below, you can see that 0.02 of a BOX UOM is what the Prepare Replenishment screen calculated when I set it to transfer 5 units. For that item, I set the BOX to be 250 units in a box. So far so good.

The unbound fields are created like this: NOTE: even though there is a “Usr” in the field, they are not actually in any table. I could create them without Usr prefix, but it doesn’t really matter here.
public class INItemPlanExt : PXCacheExtension<PX.Objects.IN.INItemPlan>
{
#region UsrTransferredUOM
[PXString(6)]
[PXUIField(DisplayName = "Transferred UOM")]
[PXDBCalced(typeof(INUnit.toUnit), typeof(string))]
public virtual string UsrTransferredUOM { get; set; }
public abstract class usrTransferredUOM : PX.Data.BQL.BqlString.Field<usrTransferredUOM> { }
#endregion
#region UsrTransferredQTY
[PXDBCalced(typeof(INItemPlan.planQty), typeof(decimal))]
[PXDecimal]
[PXUIField(DisplayName = "Transferred QTY")]
public virtual Decimal? UsrTransferredQTY { get; set; }
public abstract class usrTransferredQTY : PX.Data.BQL.BqlDecimal.Field<usrTransferredQTY> { }
#endregion
}
PROBLEM:
Note that the INItemPlan table is also used in the Prepare Replenishment screen (IN508000). When you attempt to process a replenishment item, an error is thrown because in that screen, the [PXDBCalced(typeof(INUnit.toUnit), typeof(string))] references a table that is not used on that screen. Even though it is an unbound field, the screen tries to populate the unbound field with a field from a table not on that screen.

If you try to add any custom fields to the Create Transfer Orders screen, it adds them to the INItemPlan table. In order to show those fields on the Create Transfer Orders screen, I have no choice but to add them to the INItemPlanExt.
I thought about removing the [PXDBCalced(typeof(INUnit.toUnit), typeof(string))] from the UsrTransferredQTY field and set the value in the RowSelected event for the Create Transfer Orders screen when the items are displayed on the Create Transfer Orders screen, but I cannot find a way to reference the ITItemPlanExt unbound fields in that event. In the code below, the actual RowSelected event for the grid is on the SOFixedDemand cache. There is no way to get a reference to the UDF’s as they are not in that cache.
protected void SOFixedDemand_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
SOFixedDemand row = (SOFixedDemand)e.Row;
INUnit unit = SelectFrom<INUnit>.Where<INUnit.inventoryID.IsEqual<@P.AsInt>>
.View.Select(Base, row.InventoryID);
THIS LINE FAILS
INItemPlanExt itemExt = PXCache<SOFixedDemand>.GetExtension<INItemPlanExt>(row);
}

I do NOT WANT to set the value in the RowSelected handler. It works just fine as the code is currently as the ONLY thing I am trying to do is display the two unbound fields. Is there a way to work around the [PXDBCalced(typeof(INUnit.toUnit), typeof(string))] so that it only fires “conditionally” when the Prepare Replenishment screen fires?
Thanks,
Joe