我可以从Cutom Javascript触发Ms Flow工作流吗?

问题描述 投票:0回答:1

我如何从我的自定义Java脚本代码启动/触发任何流?

我不是在问按钮流程,也没有任何现成的功能,我只是想从我的Java脚本代码触发流程

sharepoint-online flow ms-flow
1个回答
0
投票

通过“请求-当收到HTTP请求时创建流触发器”,您可以在TechNet wiki page中找到脚本。

function StartMicrosoftFlowTriggerOperations() { 
    try { 
        var dataTemplate = "{\r\n    \"emailaddress\":\"{0}\",\r\n    \"emailSubject\": \"{1}\",\r\n    \"emailBody\": \"{2}\"\r\n}"; 
        var httpPostUrl = "<Supply with the HTTP POST Url>"; 
        //Call FormatRow function and replace with the values supplied in input controls. 
        dataTemplate = dataTemplate.FormatRow($("#txtEmailAddress").val(), $("#txtEmailSubject").val(), $("#txtEmailBody").val());
         var settings = { 
            "async": true, 
            "crossDomain": true, 
            "url": httpPostUrl, 
            "method": "POST", 
            "headers": { 
                "content-type": "application/json", 
                "cache-control": "no-cache" 
            }, 
            "processData": false, 
            "data": dataTemplate 
        } 
        $.ajax(settings).done(function (response) { 
            console.log("Successfully triggered the Microsoft Flow. "); 
        }); 
    } 
    catch (e) { 
        console.log("Error occurred in StartMicrosoftFlowTriggerOperations " + e.message); 
    } 
}
© www.soinside.com 2019 - 2024. All rights reserved.