5

I am trying to perform certain action on user save event (Transaction committed phase) using tridion event system. This is working fine. I am surprised to see that the same user save event is getting triggered if I try to publish a component or a page. When i checked the saveeventargs, it showed 0 detected changes.

Why is User Save Event getting invoked while publishing using the publish window? If the publishing is performed by a Core Service call, it doesn't trigger the User Save event.

this.EventSystem.SubscribeAsync<User, SaveEventArgs>(this.OnUserCreate, EventPhases.TransactionCommitted);
private void OnUserCreate(User user, SaveEventArgs e, EventPhases phase)
{ 
    //code to perform certain action on user create
}

1 Answer 1

1

Well if I get this correctly, and I hope I do, it's because you are trying to publish an item, therefore creating new publish transaction for current user (saving new publish transaction into database under current user), therefore triggering SaveEventArgs. Or am I missing something here?

4
  • 1
    What we noticed in the publisher window is, whenever the publisher window is getting invoked the user's publish preferences are getting stored onto the server. For example, the publication target that was recently used.... Hence this user save event is getting during publishing or component or a page. Probably in many other scenarios this user save event may get triggered. we found this could be the root cause of this issue.
    – Nithya
    Commented Oct 3, 2019 at 7:11
  • Oh gottya. All clear
    – Marko Milic
    Commented Oct 3, 2019 at 7:18
  • 1
    Confirm. You spotted one of the peculiarities of the CME logic. User in CME has two aspects: userData itself and additional data such as the last visited location or user avatar that are stored in the Application Data. Whenever any of it changes, CME always sends two requests: one to update UserData (with no changes in your case) and another one to update Application Data.
    – AntonM
    Commented Oct 3, 2019 at 10:10
  • Thanks @AntonM for the detail. Yes, this aligns with our observation.
    – Nithya
    Commented Oct 5, 2019 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.