Piyush
Piyush

Reputation: 886

Get calling UserID from Custom Workflow in Dynamics CRM 4

I want to get the UserID of the current user from whom the Workflow was executed in Dynamics CRM 4.

I did it using the

IWorkflowContext.UserID

but it gets the ID of the Workflow Owner.

Upvotes: 1

Views: 850

Answers (1)

Matt Dearing
Matt Dearing

Reputation: 9386

There is no way to retrieve this information unless a user explicitly ran the workflow "on demand." If the workflow was triggered via a crm action (such as create of a record) it will run under the context of the workflow owner.

See this blog post from a member of the crm support team:

UserId: If the workflow was executed on demand, this will be the ID of the user who executed the workflow. If the workflow was executed due to a message executing, then it will be the ID of the workflow owner.

Upvotes: 1

Related Questions