This project has moved and is read-only. For the latest updates, please go here.

StartWorkflow woes

Nov 11, 2013 at 8:39 AM
So, I have a custom page which renders a table based on a list. What I am trying to do is enable my users to select one or more checkboxes (each list item has an associated HTML checkbox), and then at the click of a HTML button run a list workflow against each selected item.

I am happily at the place where my button's onclick event creates an array storing the encoded absolute URLs of each of the selected items. I currently have the code below, but the Start Workflow operation errors...
function updateSelectedComps(){
var $selectedComps = [];
        $('#inline_content input:checked').each(function() {
        }); //end each

        var $nbrSelectedComps = $selectedComps.length;

        for (var i=0; i<$nbrSelectedComps; i++){
        var $itemURL = $selectedComps[i];
            operation: "StartWorkflow",
            item: $itemURL,
            templateId: "{8B1D1946-C646-4C40-B97D-F4ADDD0AAB35}",
            workflowParameters: "<root />",
            completefunc: function(xData, Status) {
            }//end completefunc notify
        }); //end StartWorkflow 
        };//end for
}//end updateSelectedComps()
My variable $itemURL is formatted thus:
and I have checked the WF subscription ID, shown here in the templateId field.

Firebug is reporting the error :

"NetworkError: 500 Internal Server Error - https://_mysite_/sites/dev/_vti_bin/Workflow.asmx"

I guess that the problem lies in the itemURL or the templateId, but both appear correct.

In an attempt to rule out the templateId, I also coupled in the following code:
    operation: "GetTemplatesForItem",
    item: $itemURL,
    async: true,
    completefunc: function (xData, Status) {
        var currentItemURL = this.item;
        $(xData.responseXML).find("WorkflowTemplates > WorkflowTemplate").each(function (i, e) {
          if ($(this).attr("Name") == "Complete Competency Training Item") {
            var guid = $(this).find("WorkflowTemplateIdSet").attr("TemplateId");
            if (guid != null) {
              $workflowGUID = "{" + guid + "}";

                          //**Previous code went here**

                    }//end if guid 
              }//end if attr
        });//end find.each
    }//end completefunc
}); //end GetTemplates
but this never got past the
$(xData.responseXML).find("WorkflowTemplates > WorkflowTemplate").each(function (i, e)
line, as xData.responseXML appeared to to return a value.

It would be great to get this cracked as I know I will need to reuse it for similar processes elsewhere, so any help would be gratefully received.
Jan 9, 2014 at 5:07 PM
I was just looking for StartWorkflow examples and ran across your unanswered post. Sorry I missed it originally.

I think the issue is the URL you're passing in. It should be something like this fro list items:

https://_mysite_/sites/dev/Lists/Employee%20Skills%20Competency?ID=68 M.
Mar 25, 2015 at 9:17 PM
Hi fairfieldbusserv!

Did you ever figure out the problem you were having? I created a discussion yesterday on this same topic:

Let me know.