How to impersonate in Plugins


The other day a colleague question me how he could impersonate via plugin, so the records were updated with a person that had permissions, instead of the person that didn’t have.

There is two way you can do it, first and simpler is when you go to the registration plugin tool when you are editing the step you can put a specific person impersonating that plugin. The catch is that it always be that person.

Like this:

Or you can do it via code, and you can do filters to see when it should impersonate or not. Just need to set the user id.

Like this:


Hope this helps.