WorkFlowParameters Q

Mar 17, 2011 at 3:56 PM

Hello All -

I'm attempting to start a workflow while providing workflowParameters.  I'm able to start workflows fine without a parameter but with this particular workflow we want to pass a string parameter of "monthName".  More than likely what I'm providing in the workflowParameters is incorrect.  Can anyone provide some insight, or some sample code of providing parameters?

Thanks -

Mar 18, 2011 at 3:49 AM


Have you checked the docs here? There's a link to the SDK for the operations there.

Frankly, I've never tried to pass parameters into a workflow using that operation. I'm sure the answer for what the format of workflowParameters needs to be is buried in the SDK somewhere. Let me know if you figure it out! 


Apr 5, 2011 at 6:27 AM
Edited Apr 5, 2011 at 6:28 AM

RK -


is there another way to accomplish what you're trying to do?  For example, with a calculated column or something?  I've found it much easier (and more transparent) to bind everything the workflow needs somewhere in that list, and just hide it from the user forms by managing content types.  You might find it easier to troubleshoot as well.  


The SDK is almost no help in this situation -  it reads as though workflow parameters are generally things like the List ID and the workflow template ID, which are already being passed by Marc's library.  I may be wrong, but it doesn't look like the workflows accept data in this manner.  SO your alternative would be to create a calculated column or a workflow that runs prior to this one, kicking off the WF you intend to run.  I've got a number of those running that trigger time-based loops (i.e. run every monday morning, etc)

Apr 18, 2011 at 8:38 PM

I didn't find much help with the SDK either.  I turned to writing a webservice which made the calls and then parsed out the xml.

I was finally able to get this working correctly.  I only was required to pass one parameter to the workflow called "monthName".

This xml parameter was passed to the workflow library.  Example;

        operation: "StartWorkflow",
        async: true,
        item: "https://server/site/Lists/item" + idData + "_.000",
        templateId: "{c29c1291-a25c-47d7-9345-8fb1de2a1fa3}",
        workflowParameters: "<Data><monthName>" + txtBox.value + "</monthName></Data>",

Hopefully someone else will find this useful,

Apr 18, 2011 at 8:56 PM

VERY Rkbradford!  Within the workflowParameters is <monthName> the variable assignment within the workflow?  

This is a real good tip, so I hope it gets more attention and thanks for sharing!

Apr 19, 2011 at 7:07 PM

That is the parameter defined in the workflow initialization.  If you open up the %WORKFLOWNAME%.xoml.wfconfig.xml file (inside the actual workflow) in Sharepoint designer you'll see where the parameters are defined.

In my example above it shows below in my Notification.xoml.wfconfig.xml file:

<Initiation URL="Workflows/Notification Workflow/Notification Workflow.aspx">
               <Field Name="monthName" MaxLength="255" DisplayName="monthName" Description="" Direction="None" Type="Text">
                      <Default>this year</Default>
               <Parameter Name="monthName" Type="System.String" />

I was able to take the Parameter Name and plug that in.

Apr 19, 2011 at 9:57 PM

Very slick!  Thanks again for sharing...  Marc/Mike, is this worth updating the demo code?  I think this is a very powerful addition to the toolset.


Excellent stuff Rkbradford!  Can't sing enough praise... :D

Apr 27, 2011 at 3:07 PM

Added as another example with a link back: