Skip to main content
Answer

Include user name or ID that made change in Push Notification

  • July 1, 2021
  • 2 replies
  • 134 views

Forum|alt.badge.img

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

Best answer by dhollinden

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

2 replies

Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • July 2, 2021

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);
    }
  }
}

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • Answer
  • July 12, 2021

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