Javascript front-end to start the SharePoint workflow

Within the enterprise, SharePoint requirement are immediate and small-scale, require fast realization. The front of the technology a lot of time to meet user needs, while avoiding the deployment of back-end development of the IIS restart, reducing the time of deliver. In many applications, I would like to do front-end using SPservice. SPservice based on JQuery javascript library to access the SharePoint the webservice CodePlex there is a lot of introduction. For example, to click a button to start a list of workflow code as follows:

<script type="text/javascript" language="javascript" src="http://server/JQuery/jquery-1.4.4.min.js"></script>
   <script type="text/javascript" src="http://server/jquery/jquery.SPServices-0.5.8.min.js"></script>

 

var g_workflow_templateid = "{d7b03357-1ad6-40b7-8d08-0c10d2935766}";
 
$().SPServices({
    operation: "StartWorkflow",
    async: true,
    item: "http://{ServerName}/sites/{SiteName}/Lists/{ListName}/" + itemID + "_.000" ,
    templateId: g_workflow_templateid ,
    workflowParameters:"<Data/>",
    completefunc: function(xData, Status) {
       //prompt("test",xData.responseXML.xml);
              
        alert("workflow has been started.");
                              
    }
});

The need to pay attention to the parameter is templateId: g_workflow_templateid,templateId will change every time when you pass the SharePoint designer to modify the workflow. It can find the configuration files from you through the URL of the page to manually start the workflow in the list settings, view the workflow through the SharePoint designer. In addition, a need to pass the itemID of course, is the current list item ID.

From: http://www.anhero.org/javascript-front-end-to-start-the-sharepoint-workflow/