### Start New Process Instance Response Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/rrwdug/agb8im Example of a successful response when starting a new process instance, containing the new instance ID and a success flag. ```json {"result":"f30233fb-72e1-4af4-8cb8-c7e0ea9ee530","success":true} ``` -------------------------------- ### Get Start of Year Example Source: https://docs.aliwork.com/docs/yida_support/wtwabe/cnzrgo/gvtpe4/dh7m8n/whagovdhgkyy0n4k Example demonstrating how to use the YEARBEGIN function to obtain the first day of the year for a given date. This can be directly assigned to a date component. ```function YEARBEGIN() ``` -------------------------------- ### Java GET Request Example Source: https://docs.aliwork.com/docs/yida_qalist/lmvsctyt7rxtgsrq/ld80ev/ak3mya Example of making a GET request to an API endpoint using the SDK. Multiple parameters with the same name are supported. ```java String api = "/rpc/enhancedUserQuery/findUsers/byEmpIds.json"; GetClient getClient = ExecutableClient.getInstance().newGetClient(api); //加第一个工号 getClient.addParameter("empIds", "xxxxx"); //加第二个工号 getClient.addParameter("empIds", "yyyyy"); String apiResult = getClient.get(); ``` -------------------------------- ### Create a New Data Preparation Instance Source: https://docs.aliwork.com/docs/yida_updates/mw0bmqngpgz6sxba/dvch4g Navigate to the Data Preparation tab and click the 'New Data Preparation' button to access the visual setup page. This is the starting point for building data processing flows. ```en 1. Select the Data Preparation tab, click the 'New Data Preparation' button, and you will be automatically redirected to the visual setup page for data preparation. ``` -------------------------------- ### DeptBuilder Example Source: https://docs.aliwork.com/docs/yida_support/cnzrgo/gvtpe4/sdyd0ed5wbf8wi7x An example demonstrating the use of DeptBuilder with no parameters to get the current user's direct department. ```javascript DeptBuilder("") ``` -------------------------------- ### UserBuilder Example Source: https://docs.aliwork.com/docs/yida_support/cnzrgo/gvtpe4/sdyd0ed5wbf8wi7x An example demonstrating the usage of the UserBuilder function with a single user ID. ```javascript UserBuilder(["some_userid_123"]) ``` -------------------------------- ### POST /yida_vpc/process/startInstance.json Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/rrwdug/agb8im Starts a new process instance. ```APIDOC ## POST /yida_vpc/process/startInstance.json ### Description Starts a new process instance. ### Method POST ### Endpoint /yida_vpc/process/startInstance.json ### Parameters #### Query Parameters - **appType** (string) - Required - Application ID. - **systemToken** (string) - Required - Application secret key. Obtain from application data. - **userId** (string) - Required - DingTalk user ID. - **language** (string) - Optional - Language environment. Allowed values: zh_CN/en_US. - **processCode** (string) - Required - Process code. Can be found on the standalone start page link. - **formUuid** (string) - Required - Form ID. Can be found on the standalone start page link. - **formDataJson** (string) - Required - Form data. Refer to Appendix 1 for data format. - **deptId** (string) - Optional - Department ID of the initiator. If not provided, defaults to the initiator's primary department. ### Request Example ```json { "appType": "APP_PBKT0MFBEBTDO8T7SLVP", "systemToken": "hexxxx", "userId": "", "language": "zh_CN", "processCode": "TPROC--EF6Y4G8WO2FN0SUB43TDQ3CGC3FMFQ1G9400RCJ4", "formUuid": "FORM-EF6Y4G8WO2FN0SUB43TDQ3CMFQ1G9400RCJ3", "formDataJson": "{\"textField_abc\": \"Sample Value\"}", "deptId": "18295" } ``` ### Response #### Success Response (200) - **result** (string) - The ID of the newly created instance. - **success** (boolean) - Indicates if the request was successful. - **errorMsg** (string) - Error message if the request failed. - **errorCode** (string) - Error code if the request failed. #### Response Example ```json { "result": "f30233fb-72e1-4af4-8cb8-c7e0ea9ee530", "success": true, "errorMsg": null, "errorCode": null } ``` ``` -------------------------------- ### POST /startInstance Source: https://docs.aliwork.com/docs/yida_updates/hqlg7m5vvlgs0d6k/bsgnylgis2wvnh33 Initiates a new process instance. ```APIDOC ## POST /startInstance ### Description Initiates a new process instance with specified form and process details. ### Method POST ### Endpoint /api/processes/startInstance ### Parameters #### Request Body - **formUuid** (string) - Required - The UUID of the form associated with the process. - **processCode** (string) - Required - The code of the process to start. - **deptId** (string) - Optional - The ID of the department. - **formDataJson** (string) - Required - A JSON string representing the form data. ### Request Example ```json { "formUuid": "FORM-xxx", "processCode": "TPROC--xxx", "deptId": "", "formDataJson": "{\"textField_xxx\": \"单行文本\", \"textareaField_xxx\": \"多行文本\"}" } ``` ### Response #### Success Response (200) - **result** (object) - Contains the result of the operation. - **message** (string) - A message indicating the status of the operation. #### Response Example ```json { "result": {}, "message": "Process instance started successfully." } ``` ``` -------------------------------- ### Start Process Instance Source: https://docs.aliwork.com/docs/yida_updates/sb126ieg1o2x3m3u/bsgnylgis2wvnh33 Initiates a new process instance with specified form and process details. ```APIDOC ## POST /api/process/startInstance ### Description Starts a new process instance. ### Method POST ### Endpoint /api/process/startInstance ### Parameters #### Request Body - **formUuid** (string) - Required - The UUID of the form associated with the process. - **processCode** (string) - Required - The code of the process to start. - **deptId** (string) - Optional - The ID of the department. - **formDataJson** (string) - Required - A JSON string representing the form data. ### Request Example ```json { "formUuid": "FORM-xxx", "processCode": "TPROC--xxx", "deptId": "", "formDataJson": "{\"textField_xxx\": \"单行文本\", \"textareaField_xxx\": \"多行文本\"}" } ``` ### Response #### Success Response (200) - **result** (object) - The result of the operation. #### Response Example ```json { "result": {} } ``` ``` -------------------------------- ### Get Form Instance Details - Response Example Source: https://docs.aliwork.com/docs/developer/api/openAPI Example response structure for the `getFormDataById.json` API, showing success status and placeholders for error and result details. ```json { "success": "请求是否成功", "errorMsg": "错误信息", "errorCode": "错误码", "result": "表单实例详情👇🏻👇🏻👇🏻" } ``` -------------------------------- ### Start Process Instance Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/ocmxyv/fktkelqgtugmusls Initiates a new process instance with specified form and process details, and initial form data. ```APIDOC ## POST /api/yida/startInstance ### Description Starts a new process instance. ### Method POST ### Endpoint /api/yida/startInstance ### Parameters #### Request Body - **formUuid** (string) - Required - The UUID of the form associated with the process. - **processCode** (string) - Required - The code of the process to start. - **deptId** (string) - Optional - The ID of the department. - **formDataJson** (string) - Required - A JSON string representing the initial form data. ### Request Example ```json { "formUuid": "FORM-xxx", "processCode": "TPROC--xxx", "deptId": "", "formDataJson": "{\"textField_xxx\": \"单行文本\", \"textareaField_xxx\": \"多行文本\"}" } ``` ### Response #### Success Response (200) - **result** (object) - Contains the result of the operation. #### Response Example ```json { "result": "..." } ``` ``` -------------------------------- ### TableField Get and Set Value Example Source: https://docs.aliwork.com/docs/developer/components/form/tableField Demonstrates how to retrieve the current value of a TableField and how to programmatically set its values, including nested field data. ```javascript // name 为明细中姓名的表单标识 // gender 为明细中性别的表单标识 /** * 获取值 */ export function onClick() { this.$utils.toast({ title: JSON.stringify(this.$('tableField_k1rnvacg').getValue()) }); } /** * 设置值 */ export function onClick2() { // 对象数据中的 key 为每个子表单组件的唯一标识或表单标识,值为每个组件单独赋值的格式, // 如图片:https://www.aliwork.com/developer/image-field this.$('tableField_k1rnvacg').setValue([ { 'name': '宜搭', 'gender': 'male', 'avatar': [ { 'imgURL': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg', 'name': 'IMG.png', 'downloadURL': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg', 'url': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg' }, ], }, { 'name': '宜搭2', 'gender': 'female', 'avatar': [ { 'imgURL': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg', 'name': 'IMG.png', 'downloadURL': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg', 'url': 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg' } ], } ]); } ``` -------------------------------- ### Start Process Instance Data Source Source: https://docs.aliwork.com/docs/yida_subject/_1/kbz0wfr3uqku8nqr Configure this data source to initiate a new process instance. It's used for starting a new workflow. ```javascript `/${window.pageConfig.appType || window.g_config.appKey}/v1/process/startInstance.json` ``` -------------------------------- ### Python Logging Example Source: https://docs.aliwork.com/docs/yida_subject/_2/zbqlbk0sd2f6z74q Illustrates logging in Python using the logging module. The Faas template typically includes this setup. Keywords are essential for searching. ```python logger.info("您的日志") ``` -------------------------------- ### 本地预览构建产物 Source: https://docs.aliwork.com/docs/developer/guide/contributing 在完成 `npm run build` 后运行此命令,以在本地启动一个静态服务预览构建结果。通过 http://localhost:3000/ 访问,效果与线上一致并支持全局搜索。 ```bash $ npm run serve ``` -------------------------------- ### Aliwork URL Parameters Data Source Source: https://docs.aliwork.com/docs/yida_subject/_1/hwxbbskx8cpt2o63 Retrieves parameters from the current page URL. For example, on `aliwork.com/APP_xxxx/workbench?id=1&name=宜搭`, you can access `this.state.urlParams.name` to get '宜搭'. ```json { "id": "1RC66GC1JR1QGWLQFG4T7AP4NMIP28YUTW33M0", "name": "urlParams", "description": "当前页面地址的参数:如 aliwork.com/APP_xxxx/workbench?id=1&name=宜搭,可通过 this.state.urlParams.name 获取到宜搭", "formUuid": "FORM-89487D1749BC424EB39228C424F4A203ZN3K", "protocal": "URI", "isReadonly": true } ``` -------------------------------- ### Groovy Script Initialization Example Source: https://docs.aliwork.com/docs/yida_updates/_3/vrt14s Demonstrates how to initialize input parameters for a Groovy script, distinguishing between static values and variables from previous nodes. Note that initial values are strings and may require type conversion. ```Groovy input.param1 = "100" input.param2 = "20" ``` -------------------------------- ### Calculate 15 Working Days in the Future Source: https://docs.aliwork.com/docs/yida_support/wtwabe/cnzrgo/gvtpe4/dh7m8n/cwczglfr7liddmmw Example demonstrating how to calculate a date 15 working days after a given start time. The 'holidays' parameter is omitted in this case. ```Yida Formula WORKDAY("2026-01-01", 15) ``` -------------------------------- ### Java Logging Example Source: https://docs.aliwork.com/docs/yida_subject/_2/zbqlbk0sd2f6z74q Shows how to print logs in Java applications using System.out.println. Adding keywords is crucial for effective log searching. ```java System.out.println("您的日志") ``` -------------------------------- ### Java Client for Getting Pending Tasks Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/aql605 Example Java code using a PostClient to call the API for retrieving pending tasks. Ensure correct parameters and token generation. ```java @Test public void postYidaOutTaskTest() { String api = "/yida_vpc/process/getTodoTasksInCorp.json"; String corpId = "ding5d17e3add038d44535c2f4657eb63711"; String userId = "141940523222800011"; String corpCode = "AJ1L4CJVOL0UUQPTQWX8YOTCCS7O1T4CSNJF11"; PostClient postClient = ExecutableClient.getInstance().newPostClient(api); postClient.addParameter("page", "1"); postClient.addParameter("limit", "10"); postClient.addParameter("corpId", corpId); // postClient.addParameter("appTypes", "[\"APP_I3D2FD2ZQB75KLLKL48Y\"]"); postClient.addParameter("userId", userId); String token = DigestUtils.md5DigestAsHex(String.format("%s%s%s", corpId, userId, corpCode).getBytes()).toUpperCase(); postClient.addParameter("token", token); String apiResult = postClient.post(); Assert.notNull(apiResult); } ``` -------------------------------- ### Java Client for Getting Submitted Tasks Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/aql605 Example Java code using a PostClient to call the API for retrieving submitted tasks. Ensure correct parameters and token generation. ```java @Test public void postYidaOutTaskTest() { String api = "/yida_vpc/process/getMySubmmitInCorp.json"; String corpId = "ding5d17e3add038d44535c2f4657eb63711"; String userId = "141940523222800011"; String corpCode = "AJ1L4CJVOL0UUQPTQWX8YOTCCS7O1T4CSNJF11"; PostClient postClient = ExecutableClient.getInstance().newPostClient(api); postClient.addParameter("page", "1"); postClient.addParameter("limit", "10"); postClient.addParameter("corpId", corpId); // postClient.addParameter("appTypes", "[\"APP_I3D2FD2ZQB75KLLKL48Y\"]"); postClient.addParameter("userId", userId); String token = DigestUtils.md5DigestAsHex(String.format("%s%s%s", corpId, userId, corpCode).getBytes()).toUpperCase(); postClient.addParameter("token", token); String apiResult = postClient.post(); Assert.notNull(apiResult); } ``` -------------------------------- ### Single Data Source Configuration Example Source: https://docs.aliwork.com/docs/yida_subject/_1/hwxbbskx8cpt2o63 An example of a single data source configuration object, detailing its ID, text, and icon. ```javascript { id: 'cangkutong', text: '仓库通', icon: 'https://img.alicdn.com/imgextra/i3/O1CN01FLp4X81vgZK3vXt0u_!!6000000006202-2-tps-48-48.png', } ``` -------------------------------- ### Get Completed Tasks API Response (Success) Source: https://docs.aliwork.com/docs/developer/api/openAPI Example of a successful response when retrieving a list of completed tasks. Includes task data, total count, and current page. ```json { "result": { "data": [ { "processInstanceId": "abc434rfds23XXXXXX", "finishTime": "2018-03-28 17:46:14", "originatorName": "", "title": "XXX 发起的流程页面", "originatorPhoto": "//img.alicdn.com/tfs/TB1msdfsXXXXXX.jpg", "titleEn": "XXX 发起的流程页面", "createTime": "2018-03-28 17:45:43", "appType": "XXXXXX", "originatorNameEn": "XXXXXX", "originatorId": "XXXXXX", "taskId": "XXXXXX", "status": "COMPLETED" } ], "totalCount": 1, "currentPage": 1 }, "success": true } ``` -------------------------------- ### Example MySQL URL Source: https://docs.aliwork.com/docs/yida_qalist/uop0b0ndpgc0gevb/dkm8ph An example of a correctly formatted MySQL URL, including IP address, port, and database name. ```sql jdbc:mysql://47.96.37.128:3306/aaa ``` -------------------------------- ### Get Pending Tasks API Response (Success) Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/aql605 Example of a successful response when retrieving pending tasks. Includes details like process instance ID, originator, and task status. ```json { "result": { "data": [ { "processInstanceId": "XXXXXX", "originatorName": "XXX", "title": "XXX发起的流程", "originatorPhoto": "http://static.dingtalk.com/media/lADPdfafafsAXXXXXX.jpg", "titleEn": "XXX发起的流程", "createTime": "2018-04-13 13:35:58", "appType": "APP_R8MdfadfXXXXXX", "originatorNameEn": "XXXXXX", "originatorId": "XXXXXX", "taskId": "XXXXXX", "status": "NEW" } ], "totalCount": 1, "currentPage": 1 }, "success": true } ``` -------------------------------- ### Start Task Instance API Source: https://docs.aliwork.com/docs/yida_subject/_1/xn0rpgua6aftq493 API endpoint for initiating a task instance. Refer to the documentation for process initiation. ```javascript `\/${window.pageConfig.appType || window.g_config.appKey}\/v1\/process\/startInstance.json` ``` -------------------------------- ### Extract Name Using MID Function Source: https://docs.aliwork.com/docs/yida_qalist/_1/yvbgg58qnbpc4tte This formula extracts a substring starting from the third character with a length of three. It's used after splitting to get the name part, but be mindful of punctuation. ```formula MID(字段值, 3, 3) ``` -------------------------------- ### POST /v1/process/startInstance.json Source: https://docs.aliwork.com/docs/yida_support/lbtl0t/aql605 Initiates a new process instance within the Yida platform. This endpoint requires process and form identifiers, along with form data. ```APIDOC ## POST /v1/process/startInstance.json ### Description This endpoint is used to start a new process instance. You need to provide the process code, form UUID, and the form data in JSON string format. Optional parameters include the initiator's department ID. ### Method POST ### Endpoint `/v1/process/startInstance.json` ### Parameters #### Query Parameters - **processCode** (string) - Required - The unique code of the process. - **formUuid** (string) - Required - The unique identifier of the form associated with the process. - **formDataJson** (string) - Required - A JSON string representing the form data. Ensure that complex objects within this JSON are stringified if necessary. - **deptId** (integer) - Optional - The department ID of the initiator. If not provided, the initiator's primary department will be used. ### Request Example ```json { "processCode": "TPROC--EF6Y4G8WO2FN0SUB43TDQ3CGC3FMFQ1G9400RCJ4", "formUuid": "FORM-EF6Y4G8WO2FN0SUB43TDQ3CGC3FMFQ1G9400RCJ3", "formDataJson": "{\"textField_kkm9o5cd\":\"123\"}", "deptId": 18295 } ``` ### Response #### Success Response (200) - **result** (string) - The ID of the newly created process instance. - **success** (boolean) - Indicates if the request was successful. - **errorMsg** (string) - Error message if the request failed. - **errorCode** (string) - Error code if the request failed. #### Response Example ```json { "result": "f30233fb-72e1-4af4-8cb8-c7e0ea9ee530", "success": true } ``` ``` -------------------------------- ### 构建项目 Source: https://docs.aliwork.com/docs/developer/guide/contributing 执行此命令以构建项目。构建产物将输出到 build 目录。 ```bash $ npm run build ``` -------------------------------- ### Get User Information with USERFIELD Source: https://docs.aliwork.com/docs/yida_support/cnzrgo/gvtpe4/namr73vcz90gduud/oyuexdmpaxiys2tm Example demonstrating how to use the USERFIELD function to retrieve the current user's name, work number, and userId. This function is useful in forms and process validation rules. ```javascript USERFIELD(成员组件, "name") USERFIELD(成员组件, "businessWorkNo") USERFIELD(成员组件, "userId") ```