0

Is there a way i can get the status of my running workflow for a particular record? I; working on a form that has a submit button and would like to enable it only when the status of the workflow is complete. Any ideas

Thanks in advance

1 Answer 1

0

As an alternate, you may use the below javascript code:

ExecuteOrDelayUntilScriptLoaded(getWorkflowStatus, "sp.js");  
var listTitle = 'Tutorial';  
var listItemId = 1;  
var workflowTitle = 'Approval';  

function getWorkflowStatus()  
{  
  var context = new SP.ClientContext.get_current();  
  var web = context.get_web();  
  var list = web.get_lists().getByTitle(listTitle);  
  var listItem = list.getItemById(listItemId);     
  context.load(listItem);  
  context.executeQueryAsync(  
     function() {  
       var workflowStatusField = listItem.get_parentList().get_fields().getByTitle(workflowTitle); //get workflow status field  
       var workflowStatusValue = listItem.get_item(workflowTitle); //get workflow status field value  
       console.log('Approval is completed');  
     },  
    function(sender,args){  
   console.log(args.get_message());  
     }  
  );  
}  

Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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