SharePoint 2013 Get WorkFlow Status Programatically Using JSOM

The business process is programmed to get the workflow status, using JavaScript Object Model.

#######################################
# Get WorkFlow Status programatically Using JSOM
# Applies To: SharePoint 2013,JSOM,List,Office 365
# Author: Gowtham Rajamanickam
# Date:18-March-2017
#Version:1.0
######################################## 
  1. ExecuteOrDelayUntilScriptLoaded(getWorkflowStatus, "sp.js");  
  2. var listTitle = 'Tutorial';  
  3. var listItemId = 1;  
  4. var workflowTitle = 'Approval';  
  5.   
  6. function getWorkflowStatus()  
  7. {  
  8.   var context = new SP.ClientContext.get_current();  
  9.   var web = context.get_web();  
  10.   var list = web.get_lists().getByTitle(listTitle);  
  11.   var listItem = list.getItemById(listItemId);     
  12.   context.load(listItem);  
  13.   context.executeQueryAsync(  
  14.      function() {  
  15.        var workflowStatusField = listItem.get_parentList().get_fields().getByTitle(workflowTitle); //get workflow status field  
  16.        var workflowStatusValue = listItem.get_item(workflowTitle); //get workflow status field value  
  17.        console.log('Approval is completed');  
  18.      },  
  19.     function(sender,args){  
  20.    console.log(args.get_message());  
  21.      }  
  22.   );  
  23. }  
However, most likely, when you create necessary program for you sequence of tasks, you would like to improve the quality of task forms.

SP 2013 workflows allows to do it, using custom ASP.NET forms.

Using this technology, you can create really beautiful and powerful custom task forms and embed them in your WF.

If you want to know how to achieve it, keep reading my articles and blogs.

Execute the code given above and check your SharePoint site, columns are removed successfully or not.

Was my blog helpful?

If so, please let us know at the bottom of this page. If not, let us know what was confusing or missing and I’ll use your feedback to double-check the facts, add info and update this blog.
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now