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

StartWorkflow Issues

Mar 24, 2015 at 6:10 PM
Edited Mar 24, 2015 at 6:12 PM
Hey everyone!

I've been trying to use SPServices StartWorkflow operation and I've never successfully got it to work in the countless times I've tried.

I have a SP 2013 workflow that is run manually in a document library and all I want to happen is for that workflow to run on a document when a button is pushed in a custom page I created. However, I always get a 500 Internal Server Error when I run the StartWorkflow operation. Here are some questions that I believe would help me figure this out:

Item Parameter

In order to see what the Item URL was for the document, I had the workflow write the [Current Item URL] context variable to the history log. It wrote the following to the history: Document Library Name/Document Name.docx

I passed that in but I got the error. I then passed in the full path: https://ServerName/Sites/SiteName/SubSiteName/Document Library Name/Document Name.docx

Still got the error. I then noticed in the forums that others had used the itemID with a "_.000" at the end of the id: https://ServerName/Sites/SiteName/SubSiteName/Document Library Name/1_.000

That didn't work either. Which of the three should I use for the item parameter in the StartWorkflow operation?

Template ID Parameter

To find the template id of the workflow, I went to the workflow history list to see the history logs I recorded with the workflow. When I found the logs, I noticed that the Workflow Template ID field was blank in those records.

I then went back to the library, selected the document, and clicked on "Workflows" in the "FILES" tab in the ribbon. In the "Start a New Workflow" page, I right click on the workflow name link and copied the shortcut. This is what was on my clipboard: javascript:StartWorkflow4('5d0cfceb-3a84-4a6d-a6b1-511efbf8ad37', '1', '{33FB148A-FEB8-43A4-82FF-C4229170FAC3}')

I tried passing in the first and third parameter as the TemplateID in the SPServices StartWorkflow operation but as I've stated, I never got it to work. Where would be the best place for me to find the correct template id for a workflow?

I also don't need workflow parameters but I kept it in my code anyway.
    operation: "StartWorkflow",
    item: 'https://ServerName/Sites/SiteName/SubSiteName/Document Library Name/Document Name.docx',
    templateId: '{5d0cfceb-3a84-4a6d-a6b1-511efbf8ad37}',
    workflowParameters: "<root />",
    completefunc: function() {
        alert('Worflow is running');
This isn't the first time I've encountered this and I've tried to make this work on other SharePoint Servers and Sites. I've seen that others have gotten it to work and I know I must be doing something wrong that I am oblivious to. Any thoughts, suggestions, or answers would be very much appreciated! Thanks!
Oct 7, 2015 at 10:34 PM

Have you figured this out? I see you used single quotes and double quotes... Not sure of implications.

Oct 7, 2015 at 11:02 PM
Hey Zero!

Sorry to say that I have not. I ended up taking a different route with my workflow structure and this was not even needed.

No, I highly doubt the quotes are the issue here but, you may be right; I'll give that a try the next chance I get. However, as I stated in my original post, I have never gotten this to work so I've really just given up on trying to figure it out myself.

If you have any more ideas, I'm all ears.

Oct 15, 2015 at 8:29 PM
The single vs. double quotes aren't the issue, for sure. You can use either in JavaScript.

Jan 20, 2016 at 4:50 PM
This should help you, especially the code samples.