Adding Owner Name in the Purchase Order Lookup scr

2019-08-21 19:05发布

问题:

I would like to add the Owner Name (on the PO Screen) in the Purchase Order>Order Nbr. field lookup screen. I tried to manually add the following in the Data Class for OrdNbr but it didn't bring the Employee name in the lookup screen. Can you please help or let me know if i am missing something. Here is the full code i am trying(screenshot attached)

[PXCustomizeSelectorColumns(
typeof(PX.Objects.PO.POOrder.orderType),
typeof(PX.Objects.PO.POOrder.orderNbr),
typeof(PX.Objects.PO.POOrder.vendorRefNbr),
typeof(PX.Objects.PO.POOrder.orderDate),
typeof(PX.Objects.PO.POOrder.status),
typeof(PX.Objects.PO.POOrder.vendorID),
typeof(PX.Objects.PO.POOrder.vendorID_Vendor_acctName),
typeof(PX.Objects.PO.POOrder.vendorLocationID),
typeof(PX.Objects.PO.POOrder.curyID),
typeof(PX.Objects.PO.POOrder.curyOrderTotal),
typeof(PX.Objects.PO.POOrder.sOOrderType),
typeof(PX.Objects.PO.POOrder.sOOrderNbr),
typeof(PX.Objects.PO.POOrder.orderDesc),
typeof(PX.Objects.CR.CREmployee.acctCD),
typeof(PX.Objects.CR.CREmployee.bAccountID),
typeof(PX.Objects.CR.CREmployee.acctName))]

Many Thanksenter image description here

回答1:

Since POOrder.employeeID has a PXSelector attribute on its definition:

And this Selector has a DescriptionField assigned:

On this case you can add Owner name by adding this line of code to your CacheExtension file(This will obtain that DescriptionField for the EmployeeID field):

public abstract class employeeID_CREmployee_acctName : PX.Data.IBqlField { }

See Snippet below:

namespace PX.Objects.PO
{
    [PXNonInstantiatedExtension]
    public class PO_POOrder_ExistingColumn : PXCacheExtension<PX.Objects.PO.POOrder>
    {
        #region OwnerName
        public abstract class employeeID_CREmployee_acctName : PX.Data.IBqlField
        { }
        #endregion

        #region OrderNbr    
        [PXMergeAttributes(Method = MergeMethod.Append)]

        [PXCustomizeSelectorColumns(
            typeof(PX.Objects.PO.POOrder.orderType),
            typeof(PX.Objects.PO.POOrder.orderNbr),
            typeof(PX.Objects.PO.POOrder.vendorRefNbr),
            typeof(PX.Objects.PO.POOrder.orderDate),
            typeof(PX.Objects.PO.POOrder.status),
            typeof(PX.Objects.PO.POOrder.employeeID),
            typeof(PX.Objects.PO.PO_POOrder_ExistingColumn.employeeID_CREmployee_acctName),
            typeof(PX.Objects.PO.POOrder.vendorID),
            typeof(PX.Objects.PO.POOrder.vendorID_Vendor_acctName),
            typeof(PX.Objects.PO.POOrder.vendorLocationID),
            typeof(PX.Objects.PO.POOrder.curyID),
            typeof(PX.Objects.PO.POOrder.curyOrderTotal),
            typeof(PX.Objects.PO.POOrder.sOOrderType),
            typeof(PX.Objects.PO.POOrder.sOOrderNbr))]
        public string OrderNbr { get; set; }
        #endregion
    }
}

Please notice that in case the POOrder.EmployeeID field would not have the "DescriptionField" set on the PXSelector Definition, you would have to modify the PXSelector of the OrderNbr to add a LeftJoin on the Desired Table(CREmployee on this case) so you could use the desired fields and add them to the PXCustomizeSelectorColumns attribute.



标签: acumatica