我修改了LeadExtension以添加所有者ID,以便销售人员知道在通用搜索电子邮件地址期间他们的潜在客户是谁。但是我只能报告ID是一个数字,而不是描述。是否有一种简单的方法来修改以下内容以使用typeof(Contact.ownerID)报告员工的实际名称而不是ID号:
//modify leads search to report ownerid
public class LeadExtension : PXCacheExtension<Contact>
{
[PXRemoveBaseAttribute(typeof(PXSearchableAttribute))]
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXSearchable(SearchCategory.CR, "{0} {1}", new Type[] { typeof(Contact.contactType), typeof(Contact.displayName) },
new Type[] { typeof(Contact.eMail), typeof(Contact.phone1), typeof(Contact.phone2), typeof(Contact.phone3), typeof(Contact.webSite) },
WhereConstraint = typeof(Where<Current<Contact.contactType>, NotEqual<ContactTypesAttribute.bAccountProperty>, And<Current<Contact.contactType>, NotEqual<ContactTypesAttribute.employee>>>),
Line1Format = "{0}{1}{2}{3}", Line1Fields = new Type[] { typeof(Contact.salutation), typeof(Contact.phone1), typeof(Contact.eMail), typeof(Contact.ownerID) },
Line2Format = "{1}{2}{3}", Line2Fields = new Type[] { typeof(Contact.defAddressID), typeof(Address.displayName), typeof(Address.city), typeof(Address.state), typeof(Address.countryID) }
)]
public Guid? NoteID { get; set; }
}
答案 0 :(得分:1)
要显示员工的实际姓名而不是ID号,您还应该包含TM.PXOwnerSelectorAttribute.EPEmployee.acctName
字段。由于关联的Employee只能通过OwnerID字段访问, Contact.ownerID也必须出现在 TM.PXOwnerSelectorAttribute.EPEmployee.acctName
字段之前的Line1Fields数组中。并且不要忘记将Line1Format属性更改为{0}{1}{2}{4}
,否则它仍会显示ID号。
以下是您参考的最终扩展代码:
public class LeadExtension : PXCacheExtension<Contact>
{
[PXRemoveBaseAttribute(typeof(PXSearchableAttribute))]
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXSearchable(SearchCategory.CR, "{0} {1}", new Type[] { typeof(Contact.contactType), typeof(Contact.displayName) },
new Type[] { typeof(Contact.eMail), typeof(Contact.phone1), typeof(Contact.phone2), typeof(Contact.phone3), typeof(Contact.webSite) },
WhereConstraint = typeof(Where<Current<Contact.contactType>, NotEqual<ContactTypesAttribute.bAccountProperty>, And<Current<Contact.contactType>, NotEqual<ContactTypesAttribute.employee>>>),
Line1Format = "{0}{1}{2}{4}",
Line1Fields = new Type[] { typeof(Contact.salutation), typeof(Contact.phone1), typeof(Contact.eMail),
typeof(Contact.ownerID), typeof(TM.PXOwnerSelectorAttribute.EPEmployee.acctName) },
Line2Format = "{1}{2}{3}",
Line2Fields = new Type[] { typeof(Contact.defAddressID), typeof(Address.displayName), typeof(Address.city), typeof(Address.state), typeof(Address.countryID) }
)]
public Guid? NoteID { get; set; }
}