Home Blog Extending the Related Entity Dropdown

Extending the Related Entity Dropdown

Gabriel Michaud | December 30, 2019

Introduction

Editor’s Note: Often there is great value in the little tidbits picked up along one’s journey in life.  It is especially true in many disciplines, where skills is sharpened over time practicing one’s craft.  It is no different in the field of engineering & development – small but useful tidbits that are rarely documented.  With this in mind, we thought it would offer short little posts from our  MVP developer community at Acumatica that we felt would be of value to Acumatica developers.  Expect a number of these posts in the coming months.

Enjoy our first in the series Developer Tips & Tricks posts on extending the related entity Dropdown from Gabriel Michaud, a former Acumatica employee who managed our Montreal Labs and now has his own company, Velixo and one of our Acumatica Developer MVPs.

Acumatica Cloud ERP provides a number of broad capabilities for managing your activities, including tasks and events. You can create new activities in most application screens, either through the Activities tab or the page title bar.

 

Activities are always linked to a parent entity through its note ID, and can also be linked to a related entity:

 

 

I was recently asked to extend the “Type” dropdown to allow linking an activity to a custom entity. I couldn’t find any documentation on this, but by looking in the source code browser for the data access class definition of an entity that appears in the “Type” dropdown I was able to identify the property that controls this:

 

 

To test this property, I tried customizing an existing Acumatica DAC. Changing the attributes of existing fields and existing DACs is relatively easily using the Customization Project Editor of Acumatica, and within a few minutes I was able to add the required property to the PXNote attribute. After publishing my customization, I was disappointed to see that the entity was still not showing up in the related entity type dropdown.

After a lot of research I discovered that the related entity selector completely ignores changes made through customization, and that it only works on data access classes that are created from scratch. This may be an oversight, but in my case it is not really a problem since I was trying to link an activity to a custom table.

I created a new table, added the PXNote attribute with the ShowInReferenceSelector property set to true, and then added a new activity.

 

Success! I’m now able to link activities to my custom table.

One last tip – if you don’t see your table in the dropdown after publishing, I suggest restarting the application pool (iisreset). The list of related entity types is cached by Acumatica and only initialized on application start up; depending on how you publish your customization this may not always trigger a restart.

 

 

 

Gabriel Michaud

Former General Manager, Acumatica Labs Montreal. I love traveling and speaking about cloud, ERP, SaaS, software development and am passionate about what I do.

Categories: Developers, Platform

Subscribe to our bi-weekly newsletter