People need people. Contacts are a crucial component to all small businesses. Likewise, one of the most common enhancements to ERP systems is a contact lookup. Different companies use contacts for different reasons. Some use contacts to store buyers. Others use contacts to indicate Accounting functions. Moreover, some use contacts to indicate who should receive a particular document. Invoices go to one contact; Sales orders go to another contact and checks go to yet another contact. End users are creative with contact types. When a customer of ours told us, they needed to be able to select a buyer during order entry we knew we had the answer for them.

Fortunately, with Acumatica, adding a contact lookup is not a very hard task. The first step is to create an Acumatica customization project. Next, navigate to the Data Access section to add a new field to the data access class that controls the Sales order entry screen, SOOrder in this case. We learned this by inspecting the Sales order entry form.

Acumatica Select Existing Data Access Class

The Customization project editor (CPE) opens the SOrder data class and leaves you ready to Add a field. Since the contact doesn’t exist, we select create a new field. We will call our field ContactID. The display will show Buyer on the screen. Since it’s a database field of type int we select these field accordingly. In this case we inspected the contacts tab of customer maintenance to learn there was a contact class which holds datum for contacts. Its key field is ContactID which we will use to link to a contact.

Acumatica Create New Field

Next, we save the new field and publish our Customization project to create the new field by selecting publish current project from the publish menu. The Acumatica CPE creates your field and makes it available for use.

After a successful publish, navigate back to the SO.SOrder Data Access Class and select our new field. We need to decorate the field with Acumatica’s PXSelector attribute. The selector attribute is responsible for creating the lookup. This is the only code necessary to accomplish this. The selector attribute changes your field to a custom selector with a lookup and search capabilities built in. Each parameter in this attribute influences the behavior of the control.

After adding the PXSelector, save and publish your customization. You will have to work thru the syntax errors that come with balancing the unusual number of delimiters BQL uses to create a SQL Select statement.

After returning to the CPE its time to add our new control to a form. Since Sales Order is an existing screen we select “ADD SCREEN” > Customize Existing Screen”.

Acumatica Customize Existing Screen

The CPE opens the Sales Order form ready to modify. If you navigate to Form: Document > Column > Add Data Fields > Custom, you can isolate the field you just added. Select it then click the “CREATE CONTROLS” button to create the control and add it to the form. The Buyer field is now added to your form. You may move it on the form by dragging and dropping the field.

Acumatica Screen Editor

Once again, Save and publish your customization. Now we are ready to test our customization by opening the Sales Order form, creating a new order and selecting a customer. Selecting the lookup shows our new lookup.

Acumatica Lookup Field

That’s all there is to adding a custom lookup field. You can take this knowledge and apply this to any other validated field in Acumatica. Most of all we can now record a buyer on sales orders. We can look it up and select a valid buyer based on customers contacts. From this demo you can see how fields can be added and manipulated without writing a lot of code. Of course if it’s a more detailed customization we have the skill don’t hesitate to contact us.