Solved

Include user name or ID that made change in Push Notification


Hello, 

We’re publishing Acumatica push notifications to a Kafka topic as part of our system integration. It would help us greatly to identify push notifications that result from user actions in the Acumatica UI as opposed to actions that are performed via the API. One way to do this, I thought, would be to identify the user performing the actions, since actions performed via the API are always carried out under the same user account. Is it possible to include the name or ID of the user associated with an action in our push notifications?

Thank you, 

Dave

icon

Best answer by dhollinden 12 July 2021, 20:59

As a follow-up, I had a support session with @nmansinha and found that the approach I was taking in which I was adding the above code as a Code item in our customization project will not work. It needs to be added instead as a dll in the Acumatica extension library. This was not an approach we wanted to take since we’re integrating with Acumatica via Python lambda functions and the Acumatica API. 

Instead, a better solution is to add the CreatedBy and LastModifiedBy fields to our push notifications. This gives us exactly what we need and is much simpler. 

Thanks, 

Dave

View original

2 replies

I found this documentation in the Integration Development Guide

https://www.acumatica.com/media/2020/02/AcumaticaERP_IntegrationDevelopmentGuide.pdf#page=160&zoom=100,76,365

This is the code I’ve added, and it validates and compiles, but the username is not appearing in our push notifications. Any thoughts or suggestions?  

Thank you, 

Dave

---------------------------------------

using System;
using PX.Common;
using PX.Data;
using PX.Data.PushNotifications;
  
namespace ITHAKASugarFields
{
  public class AddUserName : ICommitEventEnricher
  {
    public void Enrich(IQueueEvent commitEvent)
    {
      var userName = PXContext.PXIdentity?.IdentityName;
      commitEvent.AdditionalInfo.Add(nameof(userName), userName);
    }
  }
}

 

As a follow-up, I had a support session with @nmansinha and found that the approach I was taking in which I was adding the above code as a Code item in our customization project will not work. It needs to be added instead as a dll in the Acumatica extension library. This was not an approach we wanted to take since we’re integrating with Acumatica via Python lambda functions and the Acumatica API. 

Instead, a better solution is to add the CreatedBy and LastModifiedBy fields to our push notifications. This gives us exactly what we need and is much simpler. 

Thanks, 

Dave

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved