Hello everybody,
today I want to write few words how to work with selectors in Acumatica.
So, imagine, you have the following selector in Acumatica:
<px:PXSelector ID="NmbUsrBillPMTask" runat="server" DataField="UsrBillPMTask"/>
In order to make it work as selector, you need to do the following:
[PXSelector(typeof(Search<PMTask.taskID>))]
if you'll do it, you'll receive following selector:
And if you choose there some value, you'll be able to see id represented as number. In my case it was 727.
But what if you want to make it more readable?
Then you can add following part:
[PXSelector(typeof(Search<PMTask.taskID>), SubstituteKey = typeof(PMTask.taskCD))]
Then instead of some strange number Acumatica will display TaskCD field.
But what if you have desire to add as display one more field displayed after "-" sign, as it is in some Acumatica screens. You can add another element, which is named DescriptionField.
And final part of advice, you can also customize which fields should go in the selector. Take see at the following code:
[PXSelector(typeof(Search<PMTask.taskID,
Where<PMTask.projectID, Equal<Current<PMTask.projectID>>>>), new Type[]{typeof (PMTask.taskCD), typeof (PMTask.locationID),
typeof (PMTask.description), typeof (PMTask.status)}, SubstituteKey = typeof(PMTask.taskCD), DescriptionField = typeof(PMTask.description))]
You can try to figure out details at screenshot:
Hope that can help somebody to create selector.