Home Blog Using SignalR with Acumatica Push Notifications

Using SignalR with Acumatica Push Notifications

Yuriy Zaletskyy | December 10, 2021

Using SignalR with Acumatica Push Notifications


This is a follow up on the video that I shared last week on mitigating the issue of running out of API calls using notifications and SignalR. In this blog post, I provide greater detail, along with the code that you can use in your implementation of the information that I presented.

Receiving Acumatica Push Notifications

In the following steps, I will show you directly how you can receive push notifications from Acumatica into a Windows Forms application.

Using the Acumatica Sales Demo data, make the following simple configuration changes.  Open the web.config file and search for the appSettings section and set the EnablePushNotifications key to true.

Next, create a Generic Inquiry which provide changes you need to track. Let us name it “TestInqSO”. Then we would add a SOOrder table and fields to a grid – such as Status, OrderNbr, Hold, DocBal, OrderDesc, and so on.

Next, we would then define multiple queries for each notification destination. However, the data queries should adhere to the following recommendations for optimal results:

  • Do not use aggregation and grouping in any of the queries; Acumatica ERP does not guarantee that push notifications will work correctly using these parameters.
  • Do not use joins of multiple detail tables in your queries because this may cause the system to hang.
  • If you need to join multiple tables, use a left join or an inner join in your data queries. If you use an inner join, the query execution may be slower than for a left join.
  • Use as simple a data query as possible.
  • For a query defined by using a generic inquiry, do not use a formula on the Results Grid tab of the Generic Inquiry

Now, go to the Push Notifications (SM302000) and create a new one.

In the Destination Name, type TestNotification for example.

Check the Active check box.

In the Destination Type, choose SignalR Hub.

In the Generic Inquiries tab add a new row, Inquiry Title and select the TestInqSO GI you created previously and check Active and save your changes.

At this time, you will want to create a simple Windows Forms application with two buttons:  Start and Stop to start and close the connection. Then, create  Click event handlers for each of the buttons.

Next, define the class for your notification, as shown in the following code.

GIST: https://gist.github.com/YuriyZaletskyy/7f934bd1b51eb3e1a65057c3f1c2ff91

Provide the next steps in the start click event handler:

Set up a Basic authentication token to authenticate the application in Acumatica ERP as shown in the following code.

GIST: https://gist.github.com/YuriyZaletskyy/e06bbda872d00d23b870032376958c59

Connect to an instance of Acumatica ERP as follows: 

GIST: https://gist.github.com/YuriyZaletskyy/e901c289ec2ccd51160fc0a08c175166

If you do not use Tenants, you can authenticate in the following manner:

var basicAuthToken = Convert.ToBase64String(Encoding.UTF8.GetBytes(login + “:” + password));

Then you will create a proxy to the SignalR hub based on the name of the hub that was specified in the Destination Name box when the push notification was defined on the Push Notification (SM302000) form.

GIST: https://gist.github.com/YuriyZaletskyy/2b813ec12d8a46e46f971c3a65a7871d

Process Notifications

The following code displays a MessageBox with JSON data. Structure JSON forming by the created GI TestInqSO tab Result Grid.

GIST: https://gist.github.com/YuriyZaletskyy/9695027bf9243bdda3361bb61cefcd9c

When data is created on the Acumatica instance, you will receive these changes in NotificationResult.Inserted.

When data is deleted on the instance, you will receive these changes in NotificationResult.Deleted.

When data is updated on instance, you will receive these changes in NotificationResult.Deleted (data before an update) and in NotificationResult.Inserted (data after an update).

In the Stop click event handler, just close close connection:


Now, each time there are any changes made in Sales Orders (SO301000), you will receive notifications.

The full code to accomplish all of this looks like this:

GIST: https://gist.github.com/YuriyZaletskyy/5dff485f3fcc787841b71e1e40cd6336


With the workflow described in this article, you can easily notify 3rd party services and applications about changes which happen inside of Acumatica. Also with Acumatica’s push notifications mechanism, you can get real time communication between Acumatica and other services instead of regularly calling Acumatica APIs, pushing the API call restrictions and exhausting these, impacting your application connection limits.

Happy Coding!

Related Posts

Blog Author

Yuriy started programming in 2003 using C++ and FoxPro then switching to .Net in 2006. Beginning in 2013, he has been actively developing applications using the Acumatica xRP Framework, developing solutions for many clients over the years. He has a personal blog, aptly named Yuriy Zaletskyy’s Blog, where he has been documenting programming issues he’s run into over the past six years – sharing his observations and solutions freely with other Acumatica developers.

Receive blog updates in your Inbox.