Start Workflow

Installation

Install the farm solution using stsadm or powershell

Add-SPSolution c:\Com.CodePlex.SPC3.StartWorkflow.wsp
stsadm -o addsolution -filename c:\Com.CodePlex.SPC3.StartWorkflow.wsp

Configuration

A good example of a list, is one where users are allowed to create items, but not edit items (eg for a Feedback form on a website)
Say then, you want the users to be able to cancel their feedback via a workflow.

In SharePoint designer, create a new custom button with this as the UrlAction:

{SiteUrl}/_layouts/Com.CodePlex.SPC3/StartWorkflow.aspx?List={ListId}&ItemID={ItemId}&Workflow=Cancel Feedback

If you want the dialog box, use this UrlAction instead:

javascript:SP.UI.ModalDialog.showModalDialog({url:"{SiteUrl}/_layouts/Com.CodePlex.SPC3/StartWorkflow.aspx?List={ListId}&ItemID={SelectedItemId}&Workflow=Cancel Feedback",dialogReturnValueCallback: function(dialogResult, returnValue) { SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK) }})

startworkflow.png

Last edited Feb 5, 2011 at 2:29 AM by djeeg, version 5

Comments

Atema Nov 7, 2014 at 7:46 AM 
Hello,

Thank you for this solution! It is very helpfull.
I've one question: Is it possible to change the text in the dialog box?

TIA

indranilsarkar87 Dec 3, 2013 at 11:40 AM 
I'm using the following and not working for me:

/Records/_layouts/Com.CodePlex.SPC3/StartWorkflow.aspx?List={176FB676-DC96-4389-8A8A-F8D64574C671}&ItemID={ed3b53b1-5bc8-4f3b-9e07-e0bb6d203ec3}&Workflow=Archive

Is that the Itemid is the id of yes/no select that I have input like above?

indranilsarkar87 Dec 3, 2013 at 11:10 AM 
What is the itemID here. Is this a name of a field or ID?

enemykilowatt May 31, 2013 at 6:33 PM 
I'm trying to use AutoStartWorkflow in a custom action on the list time menu by placing a link like the following in the "Navigate to Url" text box.

{SiteUrl}/_layouts/Com.CodePlex.SPC3/AutoStartWorkflow.aspx?List={ListId}&ItemID={ItemId}&Workflow=Copy

However I'm getting an error - in the ULS Log I see:

System.Workflow.Runtime.Hosting.PersistenceException: Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb. ---> Microsoft.SharePoint.SPException: Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb. ---> System.Runtime.InteropServices.COMException (0x81070E97): <nativehr>0x80004005</nativehr><nativestack></nativestack>Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.

If I use StartWorkFlow.aspx, it works, but AutoStartWorkFlow.aspx throws this error.

Any ideas what is causing this? I looked at the code in Reflector and I see that AllowUnsafeUpdates is set to TRUE for the SPWeb in question, so not sure what's going on.