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
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAs 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());
}
);
}