Ryan
Ryan

Reputation: 3982

Pass a parameter to a CRM 2011 Workflow via the API

I have a workflow that has a 'Prompt and Response' dialogue. I can run the workflow from the API using ExecuteWorkflowRequest but how do I provide values for the prompt and response inputs?

Upvotes: 3

Views: 4499

Answers (2)

Grigory
Grigory

Reputation: 550

Workflows don't take parameters.

Dialogs take parameters, which are generally passed from other dialogs or queries.

The only thing I managed to do is to pass a related entity from parent workflow as the primary entity to a child workflow.

Upvotes: 6

Greg Owens
Greg Owens

Reputation: 3878

I'm going to retract my earlier answer and upvote @Grigory instead.

See this page from the SDK

Note Due to the interactive nature of the dialog process, you cannot run a dialog using the Microsoft Dynamics CRM SDK. A dialog can only be run through the Microsoft Dynamics CRM Web application and are not supported in Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access.


I don't know the answer, but I'd be fairly confident that this is:

  • Possible
  • Unsupported (as it is not documented in the SDK)

If I really needed to find out then I'd write a plugin to explore what happens when a workflow is fired internally (this makes an assumption that such a message is fired via the plugin pipeline - not necessarily a correct assumption).

I'd register this plugin on all stages of the Execute message (I assume) and then use debug logging or an interactive debug session (attached to the Async service) to examine the InputParameters (and maybe OutputParameters and ExtensionData) of the ExecuteWorkflowRequest that is (hopefully) generated when CRM runs a workflow that does have parameters. I expect that one of those PropertyBags will contain some sort of parameter.

Upvotes: 1

Related Questions