Introduction
Editor’s Note: 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.
This is the second in our series Developer Tips & Tricks posts 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.
When Acumatica 2018 R2 was introduced, a new feature was added that allows you to set popup notes on key entities. For example, a Purchasing Manager who sees that a vendor’s contract is up for renewal can put a note on the vendor’s record. The note will pop up when a user is about to make a purchase from that vendor.
Here’s a short recorded demonstration of the Popup Note: https://recordit.co/GC6l7WAuAk
Did you know that it is possible to leverage the Popup Note system in your own customizations? Popup notes are static notes that you configure in the master data. One of our customers asked us to customize their notes to show dynamically. In this particular scenario, they wanted to inform their Order Entry clerks that an existing order for the same product and same customer already exists in the system and to verify if there were any manufacturer backorders.
Since there is currently no documentation to do this, I had to use my favorite decompiler, dnSpy to look at the implementation of popup notes in PX.Data.dll. Inside Acumatica, the Popup notes are set during the FieldVerifying event by the PXSelectorAttribute. If a Popup Note is set for the configured entity, the system calls PopupNoteManager.RegisterText as follows using dnSpy:
You can call the same function in your own code to display popup messages. For the purpose of my specific customization, I extended the Sales Order Entry graph and added an event handler for the SOLine Inventory ID field.
Below is a view of the embedded code from GibHub: https://gist.github.com/gmichaud/17e346cdf3062de233f52c9976d0a03e
After publishing the customization, the system will look for existing sales orders when you add inventory items to an order. If an order is found, our customer popup message appears as follows:
Thanks to this customization, our customer is now able to prevent duplicate orders, which happened frequently with backordered items that have a longer delivery time than usual.
Please note that as of this writing, it’s not possible to register multiple popup notes during the same callback. If PopupManager.RegisterText is called multiple times the popup window that appear will simply indicate that there are multiple notes, but will not show you the individual notes.
I hope you find this useful and you will start adding your own custom Popups to your solutions for your customers – Happy Coding!