Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: workflow parameters

$
0
0
i am trying to start a workflow with parameters. starting the workflow works great but the parameters never seem to work.
function manreject is the calling function
function StartWorkflow(ItemURL, ItemID, WFName,Params) {
var workflowGUID = null;
var loadingImage = '#Loader' + ItemID;
var workflowTD = '#WorkflowTD' + ItemID;
Params = (typeof Params === "undefined") ? "<root />" : Params;
  $().SPServices({
    operation: "GetTemplatesForItem",
    item: ItemURL,
    async: false,
    completefunc: function (xData, Status) {
      $(xData.responseXML).find("WorkflowTemplates > WorkflowTemplate").each(function(i,e) {
        // hard coded workflow name
        if ( $(this).attr("Name") == WFName ) {              
          var guid = $(this).find("WorkflowTemplateIdSet").attr("TemplateId");        
          if ( guid != null ) {
            workflowGUID = "{" + guid + "}";
          }
        }
      });
    }
  });
  //$(loadingImage).show();
  $().SPServices({
    operation: "StartWorkflow",
    item: ItemURL,
    templateId: workflowGUID,
    workflowParameters: Params,
    completefunc: function(xData,Status) {
      //$(workflowTD).html("Workflow Started");
    }
  });
}
function ManReject(lvl){
if (lvl==1){
  WFName="RejectOrder"
  //var Params="<Data><comment>1</comment></Data>"
  var Params="<Data><comment>Test This</comment></Data>"
  StartWorkflow(ItemURL, ItemID, WFName,Params)
}
}
here is the xml of the post
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<StartWorkflow xmlns="http://schemas.microsoft.com/sharepoint/soap/workflow/">
<item>http://mssharepoint01/facilities/Lists/Orders/15_.000</item>
<templateId>{23317db9-8ec8-48a8-83ac-f0346375b805}</templateId>
<workflowParameters>
<Data>
<comment>Test This</comment>
</Data>
</workflowParameters>
</StartWorkflow>
</soap:Body>
</soap:Envelope>
and here is the xml of the response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<StartWorkflowResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/workflow/">
<StartWorkflowResult></StartWorkflowResult>
</StartWorkflowResponse>
</soap:Body>
</soap:Envelope>
i get an email from the workflow, that part is working but the comment is supposed to be returned in the email body. the workflow has an Initiation Form Parameters named 'comment' it just never seems to be set. i have tried it as a local variable to and this did not work.

i am using jquery 1.8.2 on google api

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>