Francis Ducharme
Francis Ducharme

Reputation: 4987

Set InArgument when launching a workflow programmatically

Is there any way to set the value of a workflow's InArgument parameter from another workflow when launching it programmatically ?

Here's how I launch it:

var req = new ExecuteWorkflowRequest { WorkflowId = new Guid(WorkflowGuids.RenewalWorkflowId), EntityId = theContact.Id };
service.Execute(req);

I can catch the EntityId value back in the other workflow in context.PrimaryEntityId but I am at a loss as to how to populated the arguments and retrieve them on the other side.

Is this possible ? Thanks.

Upvotes: 1

Views: 476

Answers (1)

Guido Preite
Guido Preite

Reputation: 15128

InArgument are defined at step level, not at workflow level.

When a workflow is executed (by a trigger, on-demand or by code) you have the record Id.

You can create a custom workflow activity to fetch other data related (or not connected at all) with your record Id and make it as OutArgument so will be available as input for the InArgument you want to set.

Upvotes: 3

Related Questions