I am trying to add address fields to the Location selector on the Opportunities screen.
I copied the code from Sergey’s blog at https://asiablog.acumatica.com/2015/10/customizing-selector-attributes.html
From the blog, the code is like this:
#region CustomerLocationID
public abstract class customerLocationID : PX.Data.IBqlField
{
}
[PXMergeAttributesAttribute(Method = MergeMethod.Merge)]
[PXCustomizeSelectorColumns(
typeof(PX.Objects.CR.Location.locationCD),
typeof(PX.Objects.CR.Location.descr),
typeof(PX.Objects.CR.Address.addressLine1))]
[LocationID(typeof(Where<Location.bAccountID, Equal<Current<SOOrder.customerID>>,
And<Location.isActive, Equal<True>, And<MatchWithBranch<Location.cBranchID>>>>),
typeof(InnerJoin<Address, On<Location.defAddressID, Equal<Address.addressID>>>),
DescriptionField = typeof(Location.descr), Visibility = PXUIVisibility.SelectorVisible)]
public int? CustomerLocationID { get; set; }
#endregion
My code is almost exactly the same except I am using LocationID instead of CustomerLocationID
public abstract class locationID : PX.Data.IBqlField
{
}
[PXMergeAttributesAttribute(Method = MergeMethod.Merge)]
[PXCustomizeSelectorColumns(
typeof(PX.Objects.CR.Location.locationCD),
typeof(PX.Objects.CR.Location.descr),
typeof(PX.Objects.CR.Address.addressLine1))]
[LocationActive(typeof(Where<Location.bAccountID, Equal<Current<SOOrder.customerID>>,
And<Location.isActive, Equal<True>, And<MatchWithBranch<Location.cBranchID>>>>),
typeof(InnerJoin<Address, On<Location.defAddressID, Equal<Address.addressID>>>),
DescriptionField = typeof(Location.descr), Visibility = PXUIVisibility.SelectorVisible)]
public int? LocationID { get; set; }
#endregion
I also changed [LocationID to [LocationActive as the LocationID attribute is obsolete.
This is what I get on the lookup:
The descriptions are yuk and it doesn’t show the address fields.
Any advice on what I am doing wrong?
Best answer by Joe Schmucker
View original