javascript - 我可以从自定义 JavaSript 触发 Power Automate 工作流吗?
问题描述
如何从我的自定义 JavaScript 代码启动/触发任何流程?
我不是在询问按钮流程,也不是任何开箱即用的功能,我只是想从我的 JavaScript 代码触发我的流程
解决方案
通过“请求 - 收到 HTTP 请求时”创建流触发器,您可以在TechNet wiki 页面中找到该脚本。
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);
}
}
推荐阅读
- r - 如何对 data.table 中特定列的不同子集取平均值?
- jquery - 在不工作的非输入 div 字段上添加模糊
- database - 使用游标遍历内连接结果
- database - 通过 ip 地址与 RMAN 连接到数据库
- angular6 - 更改角度 6 中基于动态输入的密码指令内容?
- android - 活动结束时可以运行侦听器方法吗?
- php - 使用 PHP 函数登录后重定向到请求的页面
- twitter-bootstrap - 如果引导网格总共不是 12 列而是 9 列,一行如何使引导网格居中
- c# - Xamarin 表单 ListView 搜索
- python - 使用 pyspark 将嵌套在 JSON 文件中的结构读入 Python 中的 Spark Dataframe