简体   繁体   中英

Start Sharepoint Designer site Workflow from javascript

我们可以通过单击 javascript 按钮启动 Sharepoint Designer 站点工作流吗?

For SharePoint 2013 workflow:

function StartWF() {  
            $.ajax({  
                url: _spPageContextInfo.siteAbsoluteUrl + "/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='BB20B816-2AEF-4299-B6BF-43910578BA8F',itemId=' " + $("#drpItem option:selected").text() + "')",  
                type: "POST",  
                contentType: "application/json;odata=verbose",  
                headers: {  
                    "Accept": "application/json;odata=verbose",  
                    "X-RequestDigest": $("#__REQUESTDIGEST").val()  
                },  
                success: function (data) {  
                    alert('Workflow Trigger Successfully');  
                },  
                error: function (data) {  
                    alert("Error");  
                }  
            });  

        }

Detailed information in this thread

I remember you can do this. Should be something line __workflowStart when executing postback. You can take a look at this link for more details. https://social.msdn.microsoft.com/Forums/office/en-US/817a4366-939c-47c6-bfbc-375a00dfcaf2/genfireserverevent-workflowstart-and-parameters?forum=sharepointcustomizationlegacy

dwrt:GenFireServerEvent is translated into JavaScript with __doPostBack, by the way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM