I want to add the address field to the selectors commonly used on the Contacts, Leads and Opportunity tables. I have to join the address table to make this happen
I looked at this post, but don’t think it will allow me to join the additional table.
It's a large effort to modify every field using a Contact, Lead or Opportunities to add this join and additional column, is this the only way?
This is the code I am using for the Contact table ContactId field. it looks to work in most cases however when navigating to the contact screen from an opportunity when clicking on the contact field edit button (the pencil button) I get the following error.
“Conversion failed when converting the nvarchar value 'Leif' to data type int.” Leif is my name, so that is a clue.
#region Contact_ContactID_CacheAttached
dPXMergeAttributes(Method = MergeMethod.Merge)]
]PXCustomizeSelectorColumns(
typeof(Contact.displayName),
//typeof(Contact.classID),
typeof(Contact.eMail),
typeof(Address.addressLine1),
//typeof(Address.city),
typeof(Address.postalCode),
typeof(Contact.phone1),
typeof(Contact.ownerID),
typeof(BAccount.acctCD),
typeof(BAccount.acctName),
typeof(BAccount.parentBAccountID),
typeof(Contact.contactType)
)]
>PXSelector(typeof(Search2<Contact.contactID,
LeftJoin<BAccount, On<Contact.FK.BusinessAccount>,
LeftJoin<Address, On<Contact.FK.Address>>>,
Where<
BAccount.bAccountID, Equal<Null>,
Or<BAccount.bAccountID, Equal<Current<AccessInfo.userName>>,
And<
Contact.contactType, Equal<ContactTypesAttribute.person>,
Or<Contact.contactType, Equal<ContactTypesAttribute.employee>>>
>
>,
OrderBy<Desc<Contact.createdDateTime>>
>),
//,typeof(Address.addressLine1), typeof(Contact.eMail),
DescriptionField = typeof(Contact.displayName), Filterable = true,
SelectorMode = PXSelectorMode.Undefined)]
protected void Contact_ContactID_CacheAttached(PXCache cache)
{
}
#endregion
I tired to modify the BQL in ContactSelectorAttribute.
Type type = BqlCommand.Compose(typeof(Where<,,>), typeof(BAccount.bAccountID), typeof(IsNull), typeof(Or<>), typeof(Match<,>), typeof(BAccount), typeof(Current<>), typeof(AccessInfo.userName));