Skip to main content

Hello,

 

I have a CRM entity event in my workflow, that creates an incident in our CRM system. Is it possible to impersonate the user who starts the workflow as the created by in CRM, instead of the K2 system user?

 

 

Hi janev

 

As you are aware the workflow will execute any smartobject methods as the service account. You can change the execution account for an event, but you must hard code an account and password, which doesn't help you.

 

The only way I can think to do this would be to write some custom code (using the K2 Default Server Event (code) event) that calls the CRM smartobject using impersonation. You will need to understand the SmartObject API and work out how to impersonate the workflow originator.


Hi Janev,

 

Please find my comment . you can not execure CRM entity smart object in impersonated user context in process , process always run in k2_service account context so whenever in process any smart object exection will be there so created or update by will be as k2 service account . but if same impersonaetd smart object will run from smart froms then user details will be there . so there is some workarounf you can do as below .

  •  Create a custom field like "ActionedUser" in CRM entity 
  • Get the user domain id and call user smart object to get the user GUID
  • On each action try to get user details from k2 form 
  • At time of CRM smart object execution pass the user GUID 

THis is a approach where you can track the user details .

 

- Arvind


Thanks guys,

Arvind, your approach is the one I've been using so far, but I thought I´d check here if any ,,cleaner'' solution was available. 


Great janev 🙂

Reply