华为云ASTRO轻应用-启动华为云Astro轻应用工作流:在脚本中启动工作流
时间:2025-03-03 11:35:20
在脚本中启动工作流
在脚本代码中,通过导入工作流的脚本库,来启动工作流。
- 参考创建空白华为云Astro轻应用脚本中操作,创建一个空白脚本。
- 在脚本代码中,导入工作流的脚本库,通过脚本代码启动工作流。
import * as bp from "bp"; //......(其他代码) const client = bp.newInstanceClient(); client.start(工作流名称, 工作流版本号, 工作流中定义的变量);
脚本样例如下:
import * as bp from 'bp'; let client = bp.newInstanceClient(); let res = client.start("test", "1.0.1", { "foo": 1, "bar": 3});
- 单击页面上方的
,保存脚本。
- 单击页面上方的
,执行脚本。
- 在页面底部单击测试窗口右上角的
,查看输出参数。
输出样例如下:
{ "interviewId": "002N000000FdtN6xwgjI", "screen": { "allowBack": false, "allowFinish": true, "allowNext": true, "allowPause": false, "helpText": "", "label": "input phone number", "name": "inputphonenumber", "pausedText": "", "screenFields": [ { "dataType": "text", "defaultValue": "135xxxxxxxx", "fieldType": "InputField", "helpText": "", "isRequired": false, "label": "phone number", "name": "phoneNumber" } ] }
support.huaweicloud.com/usermanual-astrozero/astrozero_05_9185.html