Get ModifiedBy in global event Handler

Ashish Kashyap asked on June 11, 2020 16:23

Hi Guys,

I am writng a event handler to content staging from staging to production server to automate to content staging by follow below documents, which is working fine.

https://docs.kentico.com/k11/custom-development/handling-global-events/automatically-synchronizing-staging-and-integration-tasks

Now, I want to automate content staging only when content is modified by GlobalAdmin.

I am not able to see the UserModifiedBy in this event handler

So, how can I find the ModifiedBy user in any kentico handler?

Thank you in advance for your help.

Recent Answers


Dmitry Bastron answered on June 11, 2020 16:48

Hi Ashish,

Reference between User and Staging Task is stored in a separate object - StagingTaskUserInfo retrieved by StagingTaskUserInfoProvider. In your handler you can:

  • Get the TaskID from e.Task.TaskID
  • Using StagingTaskUserInfoProvider find UserID by TaskID
  • Using UserInfoProvider get user details by UserID

Or you can even merge these queries into one SQL query joining these tables.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.