Patrik
Patrik

Reputation: 1129

Get executive workflow name - CRM 4

I have started to write a workflow assembly for CRM 4.0 that should kill any other running workflows with the given name (in my case, all other workflows except him self).

ConditionExpression ce = new ConditionExpression();
ce.AttributeName = "name";
ce.Values = new Object[]{this.WorkflowName}; // Dependency Property
query.EntityName = EntityName.asyncoperation.ToString();

Has anyone an idea, how to get the current workflow name out of the IContextService or something like that?

Best regards

Upvotes: 1

Views: 148

Answers (1)

James Wood
James Wood

Reputation: 17562

Its a bit of a long way around, but you could use IWorkflowContext.AsyncOperationId to get the ID of the current workflow.

Using that ID you can then query the asyncoperation to get the name of the workflow.

Upvotes: 1

Related Questions