Skip to main content
Answer

Set selected Production order's Order type in another field

  • May 9, 2024
  • 1 reply
  • 49 views

Forum|alt.badge.img+1

Hi all,

 

I have a selector in SOLine grid as follows.

#region UsrProductionNbr
        [PXDBString(15)]
        [PXUIField(DisplayName = "Production Nbr")]
        [PXSelector(
            typeof(Search<AMProdItem.prodOrdID,
        Where<AMProdItem.inventoryID, Equal<Current<SOLine.inventoryID>>>>),
          typeof(AMProdItem.orderType),
            typeof(AMProdItem.prodOrdID))]
public virtual string UsrProductionNbr { get; set; }
public abstract class usrProductionNbr : PX.Data.BQL.BqlString.Field<usrProductionNbr> { }
#endregion

 

I have another field for production order type in the same grid as follows.
 

        #region UsrProdOrdType
[PXDBString(5)]
[PXUIField(DisplayName = "Prod. Order Type", Enabled = false)]
public virtual string UsrProdOrdType { get; set; }
public abstract class usrProdOrdType : PX.Data.BQL.BqlString.Field<usrProdOrdType> { }
#endregion

 

I want to set the UsrProdOrdType value based on selected production order in UsrProductionNbr selector once it is selected. 

 

How can I do this?

Thanks.

Best answer by darylbowman

I think you actually have this logic backwards. The UsrProductionNbr field is only storing the ProdOrdID value, not a AMProdItem record, which means you can’t retrieve the Order Type from the selected record. The correct logic would be to first select an Order Type from UsrProdOrdType and then only show those order types in the UsrProductionNbr selector.

1 reply

darylbowman
Captain II
Forum|alt.badge.img+15

I think you actually have this logic backwards. The UsrProductionNbr field is only storing the ProdOrdID value, not a AMProdItem record, which means you can’t retrieve the Order Type from the selected record. The correct logic would be to first select an Order Type from UsrProdOrdType and then only show those order types in the UsrProductionNbr selector.