2

The following code works well in my test environment, but not in my UAT environment. Both are running SharePoint 2013.

var ctx = new SP.ClientContext.get_current();
var wfServicesMgr = new SP.WorkflowServices.WorkflowServicesManager(ctx, ctx.get_web());
var wfInteropService = wfServicesMgr.getWorkflowInteropService();
wfInteropService.cancelWorkflow(workflowInstanceId);
ctx.executeQueryAsync(function(source, args){
    // Works in one enviroment
}, function (source, args) {
    // Results in the following message in another environment
    //    Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. 
    //    "GetWorkflowInteropService new Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager()"
    var msg = args.get_message();
});

As mentioned in the comments above, the error I see in UAT is:

Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "GetWorkflowInteropService new Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager()"

Any ideas? I don't think I need to worry about workflow configuration in either environment since these are 2010 workflows and not 2013 workflows.

3
  • 2
    Is the workflow service setup on the UAT environment? The error message sort of implies that when trying to instantiate the service nothing is returned. In my experience this is usually because the service has been provisioned or is in some sort of broken state. Commented Aug 15, 2016 at 17:57
  • I don't have direct access to the environment so am at a disadvantage. I have asked, but don't have an answer yet. Commented Aug 16, 2016 at 22:47
  • Thanks @El Hombre (yes, I know who you are). I had the same suspicion as you and it turned out to be the answer. Commented Aug 17, 2016 at 13:24

1 Answer 1

0

The answer for me was to make sure the workflow manager was installed properly in the environment. Even though I was trying to terminate a 2010 WF, we need the WF manager running for this code to work, it appears.

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.