Skip to main content

I need to set SONbr to only transfer Screen(IN304000) warehouse equal to sales Order screen(SO301000) warehouse(siteID).

 

errors in :     if (sOLine.siteID == row.siteID)

 

 

this is my code: 

protected void INTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            //Row selected for UsrSONbr
            var row = (INTran)e.Row;

            if (row == null) return;

                SOLine sOLine = new PXSelect<SOLine, Where<SOLineExt.usrTransferNbr,
                                                Equal<Required<SOLineExt.usrTransferNbr>>,
                                                And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>>>>
                                                (Base).Select(row.RefNbr, row.InventoryID);
            if (sOLine != null)

                //if (typeof(SOLine.siteID) == typeof(INSite.siteID))
                if (sOLine.siteID == row.siteID)
                {

                        {

                            INTranExt iNTranExt = PXCache<INTran>.GetExtension<INTranExt>(row);
                            iNTranExt.UsrSONbr = sOLine.OrderNbr;
                            cache.SetValueExt<INTranExt.usrSONbr>(row, iNTranExt.UsrSONbr);


                        }
                 }

        }

In regular code (not BQL statements or typeof() statements, the field names must be capitalized.

if (sOLine.siteID == row.siteID)

should be 

if (sOLine.SiteID == row.SiteID)

Additionally, you're running several database queries in RowSelected which is not advised.


@tharinduweerasooriya90  Please refer to the below example, which solves this problem as well

 

 


Reply