You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为客户/供应商ID查找添加CSAnswer属性选择列?已试StackOverflow方案无效

Hey there! Let's work through getting those CSAnswer attributes added to your Customer ID and Vendor ID lookups—since the inventory lookup guide didn't quite work here, we'll tailor the process specifically for customer and vendor screens.

Step 1: Double-Check Your CSAnswer Attribute Setup

First, make sure the attribute you want to add is actually linked to the Customer and Vendor entities. Head to the Attributes (CS.20.00.00) screen, find your attribute, and confirm its Entity Type is set to both Customer (AR.30.30.00) and Vendor (AP.30.30.00). This ensures the attribute values are tied to the right records.

Step 2: Extend the Customer/Vendor Lookup DACs

Next, we need to add custom fields to the lookup data access classes (DACs) for customers and vendors.

For the Customer Lookup, create this DAC extension:

public class CustomerLookupExtension : PXCacheExtension<PX.Objects.AR.CustomerLookup>
{
    #region UsrCustomerAttrValue
    [PXString]
    [PXUIField(DisplayName = "Your Attribute Name")] // Replace with your attribute's display name
    public virtual string UsrCustomerAttrValue { get; set; }
    public abstract class usrCustomerAttrValue : PX.Data.BQL.BqlString.Field<usrCustomerAttrValue> { }
    #endregion
}

For the Vendor Lookup, use this similar extension:

public class VendorLookupExtension : PXCacheExtension<PX.Objects.AP.VendorLookup>
{
    #region UsrVendorAttrValue
    [PXString]
    [PXUIField(DisplayName = "Your Attribute Name")] // Replace with your attribute's display name
    public virtual string UsrVendorAttrValue { get; set; }
    public abstract class usrVendorAttrValue : PX.Data.BQL.BqlString.Field<usrVendorAttrValue> { }
    #endregion
}

Note: Replace UsrCustomerAttrValue/UsrVendorAttrValue with a meaningful field name, and update the DisplayName to match your attribute.

Step 3: Join CSAnswer Data to the Lookup Views

Now we need to pull the actual CSAnswer values into the lookup views by modifying the customer and vendor maintenance graphs.

For Customer Maintenance:

public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
    public override void Initialize()
    {
        base.Initialize();
        
        // Define your attribute ID as a constant (replace "YOUR_CUSTOMER_ATTR_ID" with your actual ID)
        const string CustomerAttrID = "YOUR_CUSTOMER_ATTR_ID";

        // Add CSAnswer value to the customer lookup view
        Base.CustomerLookupView.View.Select.Add(
            typeof(CSAnswer.value).Column
                .Where(
                    CSAnswer.refNoteID.IsEqual<Customer.noteID>()
                    .And(CSAnswer.attributeID.IsEqual(CustomerAttrID))
                )
        );
    }
}

For Vendor Maintenance:

public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
    public override void Initialize()
    {
        base.Initialize();
        
        // Replace "YOUR_VENDOR_ATTR_ID" with your actual attribute ID
        const string VendorAttrID = "YOUR_VENDOR_ATTR_ID";

        // Add CSAnswer value to the vendor lookup view
        Base.VendorLookupView.View.Select.Add(
            typeof(CSAnswer.value).Column
                .Where(
                    CSAnswer.refNoteID.IsEqual<Vendor.noteID>()
                    .And(CSAnswer.attributeID.IsEqual(VendorAttrID))
                )
        );
    }
}
Step 4: Update the Lookup Screen Layouts

Now let's add the new fields to the lookup screens:

  • Open your customization project, navigate to the Customer Lookup (AR.30.30.00) screen
  • Open the Layout Editor, find the section where you want to add the attribute column
  • Drag your custom UsrCustomerAttrValue field from the "Available Fields" panel into the layout
  • Repeat the same process for the Vendor Lookup (AP.30.30.00) screen, adding the UsrVendorAttrValue field
Step 5: Test and Troubleshoot

Save and publish your customization project, then:

  1. Open the Customers (AR.30.30.00) screen, click the magnifying glass next to Customer ID—you should see your new attribute column
  2. Do the same for the Vendors (AP.30.30.00) screen

If the field doesn't show up, check these common issues:

  • Did you set the correct Entity Type for your CSAnswer attribute?
  • Is the attribute ID in your graph extension an exact match to the attribute's ID in the CS.20.00.00 screen?
  • Are there any errors in the System Monitor (SM.20.50.50) that might point to a query or DAC issue?

内容的提问来源于stack exchange,提问作者RuslanDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:42:52