Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a form that start a workflow automatically when an item is created, and I redirect to html page that shows a message like "Processing... please wait.", and I wait 3 seconds and so redirect to a page with results of the workflow.

Instead of wait 3 seconds, I want to create a javascript that check if the workflow is completed, then redirect to results page.

I am using SharePoint 2010 Foundation

Is there way?

share|improve this question
    
Please add the version of SharePoint (2007,2010,2013) as a tag to your question. –  Vardhaman Deshpande Jul 17 '13 at 19:37
    
@VardhamanDeshpande ok. I added the tags. It is SharePoint 2010 Foundation. –  Guilherme J Santos Jul 17 '13 at 19:39
add comment

1 Answer 1

up vote 3 down vote accepted

I haven't tried this method, but I think it should work. If you use the Lists web service to query for the particular item, you should be able to retrieve the workflow status column and see it's value. It should give you In Progress/Complete. In your code, you'd just need to check that status and wait/recheck in a few seconds or redirect to your page based on the results.

Edit: I tried using SPServices and it does work:

$().SPServices({
    operation: "GetListItems",
    async: false,
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='WFColumn' /></ViewFields>",
    listName: "MyList",
    completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode("z:row").each(function() {
            if ($(this).attr("ows_WFCol" === 5)){
                console.log("It's complete");
          }
        });
    }
});
share|improve this answer
    
worked like a charm! I love SPServices! How I lived all this time without it???? Thanks! –  Guilherme J Santos Jul 19 '13 at 15:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.