如何在SP2013列表上停止已删除的关联工作流实例? [英] How can I stop deleted association workflow instances on a SP2013 list?

查看:96
本文介绍了如何在SP2013列表上停止已删除的关联工作流实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:


我无法从列表中停止已删除的关联工作流实例。我发现了一个似乎是一个可行解决方案的帖子,但我无法提供该解决方案的链接,因为看来我不允许在此帖子的正文字段中包含一个链接
!!该解决方案是关于抓取"已删除关联"工作流的实例ID,并将其从工作工作流中的以下链接复制以终止不需要的实例:


javascript: if(confirm(endWorkflowConfirm)){TerminateWorkflow4('a63795da-eac7-49e7-bd16-ac8ab014e053');}


这需要在工作流页面中使用,以便JS函数是无障碍。但是我没有找到任何定义了TerminateWorkflow4的工作流程页面。我尝试使用PowerShell没有运气,到目前为止还没有找到任何其他可行的解决方案
。请让我知道如何解决这个问题。


谢谢,


Minoo

解决方案

嗨Minoo,


根据您的描述,它可能是使用代码定义TerminateWorkflow函数的网页。 / p>

您可以使用下面的JSOM代码,并调用terminateWorkflow()函数来终止工作流实例。

 function terminateWorkflow( listId,itemId,subId){

var context = SP.ClientContext.get_current();

var workflowServicesManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context,context.get_web());

var workflowInstanceService = workflowServicesManager.getWorkflowInstanceService();

var wfInstances = workflowInstanceService.enumerateInstancesForListItem(listId,itemId);

context.load(wfInstances);

context.executeQueryAsync(

函数(sender,args){

var instancesEnum = wfInstances.getEnumerator();

while(instancesEnum.moveNext()){

var instance = instancesEnum.get_current();

if(instance.get_workflowSubscriptionId()。toString()== subId ){

workflowInstanceService.terminateWorkflow(instance);

context.executeQueryAsync(

function(sender,args){

console.log(" Termination Successful");

},

function(sender,args){

console.log( "无法终止工作流程。";

console.log("错误:" + args.get_message()+" \ n" + args.get_stackTrace());

}

);

}

}

},

函数(发件人,args){

console.log("无法加载实例。");

console.log("错误:" + args.get_message()+" \ n" + args.get_stackTrace());

}

);

};

参考:


https://sharepoint.stackexchange.com/questions/174755/how-to-stop-a-sharepoint-workflow-using -jsom


祝你好运,


Grace Wang


Hi:

I am having trouble stopping deleted association workflow instances from a list. I have come across a post that seems to be a workable solution, but I cannot provide the link to that solution as it appears that I am not allowed to include a link in the body field of this post!! That solution is about grabbing the instance id of the "deleted association" workflow, and copy it over the following link from a working workflow to terminate the unwanted instance:

javascript:if(confirm(endWorkflowConfirm)) {TerminateWorkflow4('a63795da-eac7-49e7-bd16-ac8ab014e053');}

This needs to be used within a workflow page so that the JS function is accessible. however I did not find any workflow page where TerminateWorkflow4 is defined. I tried PowerShell with no luck and haven't been able to find any other workable solution so far. Please let me know how to fix this.

Thanks,

Minoo

解决方案

Hi Minoo,

From your description, it might be the web page which use code to define a TerminateWorkflow function.

You can use the JSOM code below, and invoke the terminateWorkflow() function to terminate the workflow instance.

function terminateWorkflow(listId, itemId, subId){

    var context = SP.ClientContext.get_current();

    var workflowServicesManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, context.get_web());

    var workflowInstanceService = workflowServicesManager.getWorkflowInstanceService();

    var wfInstances = workflowInstanceService.enumerateInstancesForListItem(listId, itemId);

    context.load(wfInstances);

    context.executeQueryAsync(

        function(sender, args){

            var instancesEnum = wfInstances.getEnumerator();

            while(instancesEnum.moveNext()){

                var instance = instancesEnum.get_current();

                if(instance.get_workflowSubscriptionId().toString() == subId){

                    workflowInstanceService.terminateWorkflow(instance);

                    context.executeQueryAsync(

                        function(sender, args){

                            console.log("Termination Successful");

                        },

                        function(sender,args){

                            console.log("Failed to terminate workflow.");

                            console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());

                        }

                    );

                }

            }

        },

        function(sender,args){

            console.log("Failed to load instances.");

            console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());

        }

    );

};

Reference:

https://sharepoint.stackexchange.com/questions/174755/how-to-stop-a-sharepoint-workflow-using-jsom

Best regards,

Grace Wang


这篇关于如何在SP2013列表上停止已删除的关联工作流实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆