> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Cross-App JS API

> Detailed reference for form and workflow operation APIs, including how to create, update, and delete form instances, and how to start, update, and delete workflow instances.

Call these APIs using `this.utils.yida.<function name>`.

## Form Operation APIs

| **Function name**                  | **Description**                                     | **Request example**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ---------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **saveFormData**                   | Create a form instance                              | `// Create a form instancethis.utils.yida.saveFormData({  formUuid: 'FORM-xxx',  appType: pageConfig.appType,  formDataJson: JSON.stringify({    textField_m1g4dcpy: 'Single-line text',    textareaField_m1g4dcpz: 'Multi-line text',  }),}).then((res) => {  console.log('Create result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                |
| **updateFormData**                 | Update the value of a specified component in a form | `// Update the value of a specified component in a formthis.utils.yida.updateFormData({  formInstId: 'FINST-xxx',  updateFormDataJson: JSON.stringify({    textField_m1g4dcpy: 'Single-line text',    textareaField_m1g4dcpz: 'Multi-line text',  }),  useLatestVersion: 'y',}).then((res) => {  console.log('Update succeeded');}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                |
| **searchFormDataIds**              | Search form instance IDs by criteria                | `// Search form instance IDs by criteriathis.utils.yida.searchFormDataIds({  formUuid: 'FORM-xxx',  currentPage: 1,  pageSize: 10,  searchFieldJson: JSON.stringify({    textField_m1g4dcpy: 'Single-line text',    textareaField_m1g4dcpz: 'Multi-line text',  }),}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                       |
| **getFormComponentDefinationList** | Get the form definition                             | `// Get the form definitionthis.utils.yida.getFormComponentDefinationList({  formUuid: 'FORM-xxx',  version: '',}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                          |
| **deleteFormData**                 | Delete a form instance                              | `// Delete a form instancethis.utils.yida.deleteFormData({  formUuid: 'FORM-xxx',}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                                                         |
| **getFormDataById**                | Get form instance details by form instance ID       | `// Get form instance details by form instance IDthis.utils.yida.getFormDataById({  formInstId: 'FINST-xxxx',}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                             |
| **searchFormDatas**                | Search form instance details by criteria            | `// Search form instance details by criteriathis.utils.yida.searchFormDatas({  formUuid: 'FORM-xxx',  searchFieldJson:'',// Search by form component values  currentPage:'1',  pageSize:'10',  originatorId:'',// Search by data submitter's Employee ID  createFrom:'2024-01-01',  createTo:'2024-02-01',  modifiedFrom:'2024-01-01',  modifiedTo:'2024-02-01',  dynamicOrder:'',// Sort}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});` |

## Workflow Operation APIs

| **startInstance**   | Start a workflow                                 | `// Start a workflowthis.utils.yida.startProcessInstance({  formUuid: 'FORM-xxx',  processCode:'TPROC--xxx',  deptId:'',  formDataJson: JSON.stringify({    textField_xxx: 'Single-line text',    textareaField_xxx: 'Multi-line text',  }),}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                                                                                               |
| ------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **updateInstance**  | Update a workflow instance                       | `// Update a workflow instancethis.utils.yida.updateProcessInstance({  processInstanceId: 'f30233fb-xxx-9ee530',  updateFormDataJson: JSON.stringify({    textField_xxx: 'Single-line text',    textareaField_xxx: 'Multi-line text',  }),}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                                                                                                 |
| **deleteInstance**  | Delete a workflow instance                       | `// Delete a workflow instancethis.utils.yida.deleteProcessInstance({  processInstanceId: 'f30233fb-xxx-9ee530',}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **getInstances**    | Get workflow instance details by search criteria | `// Get workflow instance details by search criteriathis.utils.yida.getProcessInstances({  formUuid:'FORM-xxx', // Form ID  taskId:'2199132092', // Task ID  instanceStatus:'RUNNING', // Instance status  approvedResult:'agree', // Approval result  currentPage:'1',  pageSize:'10',  originatorId:'2134', // Search by workflow initiator's Employee ID  createFrom:'2024-01-01',  createTo:'2024-02-01',  modifiedFrom:'2024-01-01',  modifiedTo:'2024-02-01',  searchFieldJson: JSON.stringify({    textField_xxx: 'Single-line text',    textareaField_xxx: 'Multi-line text',  }),}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});` |
| **getInstanceIds**  | Search workflow instance IDs by criteria         | `// Search workflow instance IDs by criteriathis.utils.yida.getProcessInstanceIds({  formUuid:'FORM-xxx', // Form ID  taskId:'2199132092', // Task ID  instanceStatus:'RUNNING', // Instance status  approvedResult:'agree', // Approval result  currentPage:'1',  pageSize:'10',  originatorId:'2134', // Search by workflow initiator's Employee ID  createFrom:'2024-01-01',  createTo:'2024-02-01',  modifiedFrom:'2024-01-01',  modifiedTo:'2024-02-01',  searchFieldJson:JSON.stringify({    textField_xxx: 'Single-line text',    textareaField_xxx: 'Multi-line text',  }),}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`        |
| **getInstanceById** | Get workflow instance details by instance ID     | `// Get workflow instance details by instance IDthis.utils.yida.getProcessInstanceById({  processInstanceId:'f30233fb-xxx-530',}).then((res) => {  console.log('Request result', res);}).catch(({ message }) => {  this.utils.toast({    title: message,    type: 'error',  });});`                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
