forge

Turning a GET into a POST for SPWorkflowManager.StartWorkflow()

I mentioned in a previous post that you must run StartWorkflow on a POST request and not a GET request but I didn’t have time then to figure out how to do this quickly in a web part…  Here’s how to do it…  In any WebControl (or anything that can be to the Page object) add the following line.

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “post”, “<SCRIPT Language=\”JavaScript\”>\n<!–\ndocument.forms[0].submit();\n–>\n</SCRIPT> “, false);

This will cause the page to post back to itself once it’s loaded.  It’s a kluge, but it solves the issue

2 replies

Comments are closed.