答案 0 :(得分:2)
如果您只想显示添加到客户的自定义字段,您可以按照下面的屏幕截图显示
如果您想在某些事件或操作下的代码中获取自定义字段的值,您可以执行以下操作:
using PX.Data;
using PX.Objects.AR;
using PX.Objects.SO;
using PX.Objects.CR;
using System;
namespace ClassLibrary1
{
public class SOOrderEntryExt: PXGraphExtension<SOOrderEntry>
{
public virtual void Customer_RowSelecting(PXCache sender,PXRowSelectingEventArgs eventArgs,PXRowSelecting baseMethod)
{
baseMethod?.Invoke(sender, eventArgs);
if(eventArgs.Row!=null)
{
Customer currentCustomer = (Customer)eventArgs.Row;
BAccountExt currentCustomerExtension = PXCache<BAccount>.GetExtension<BAccountExt>(currentCustomer);
var value = currentCustomerExtension.UsrCustomerNote;
}
}
}
}
Customer
继承自BAccount
类,因此在以下行中不会出现任何问题:
BAccountExt currentCustomerExtension = PXCache<BAccount>.GetExtension<BAccountExt>(currentCustomer);
在此行之后,您拥有自定义字段的值,并可以根据需要使用它:
var value = currentCustomerExtension.UsrCustomerNote;