Sometimes you want to add additional selector column to the screen, but this process not always is super strait forward.
I will try to guide you step by step, how to add additional address line column to location selector on Sales Orders Screen.
First of all lets create a new customization try to analyse this selector control.
If you select this field and check attributes, that you can can see that there is no selector attribute, but we have strange LocationIDAttribute. Actually selector is there, but it is hidden by LocationIDAttribute. Sometimes to accumulate some logic in one attribute, Acumatica developers uses special types attributes – PXAccumulatorAttribute. This attribute has a collection of other attributes inside. During runtime, Acumatica framework will check that our attribute is inherited from Accumulator and will add all nested attributes in the PXCache.
Ok, but how to customize selector columns? And here Acumaita frameworks, starting from version 5.0 has super nice feature – additional attribute that will customize selector columns even if selector is nested. Just specify PXCustomizeSelectorColumns and define columns that yoг want to see.
[PXCustomizeSelectorColumns( typeof(PX.Objects.CR.Location.locationCD), typeof(PX.Objects.CR.Location.descr), typeof(PX.Objects.CR.Address.addressLine1))]
You can add this attribute manually, or using visual designers. Do the following:
- Select required field in DAC customization window.
- Click Selector Columns
- In this popup panel you will see all current selector columns
- Click Add Columns
- Here you will see all available columns for this selector.
- Try to filter columns by “Address”
Actually, there is no any address in the list of available columns, except Default Address – this is a link to another DAC, that holds address information.
So we have to add a join condition from our selector to address table using this field. Please, refer to where we have a source code of LocationIDBase Atrribute and notice there an additional constructor parameter – JoinType.
Lest just customize the LocationID attribute with additional Join condition and lets add PXCustomizeSelectorColumns with address field as well.
There result customization code is here:
Now you can just publish the customization and use your new super nice user interface.