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

# Complete steps

> Complete steps in the app or using the API

## Completing a form or routing step in the app

A form step is completed when you have finished all the form fields and click the **Complete** button under the form. That also applies to routing steps, where you select your decision and click **Complete**.

<Frame>
  <img src="https://mintcdn.com/nextmatter/I7XEPsBmVpUZVtva/images/docs/45e6262-ar8.png?fit=max&auto=format&n=I7XEPsBmVpUZVtva&q=85&s=36221f5d647be3fb3b5911f71c327497" alt="Image showing a step waiting to be completed" width="2940" height="1671" data-path="images/docs/45e6262-ar8.png" />
</Frame>

<Tip>
  You can edit a completed step as long as the workflow instance is still in progress. However, if conditional steps follow, and they have already been completed, the updates to the form step **won't** affect the completed conditions.
</Tip>

<iframe width="560" height="315" src="https://demo.arcade.software/XFDUJtHKo6s5kaTaipIY?embed" title="Tutorial" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen" allowFullScreen aria-describedby="Online tutorial" />

## Completing an automated step

Those steps do not need your input and are completed automatically. If an automated step produces an error, the workflow technical lead is notified by email and can update and restart the step.

<Frame>
  <img src="https://mintcdn.com/nextmatter/bsmXZ466WcpOtxYo/images/docs/70d6117-automated.png?fit=max&auto=format&n=bsmXZ466WcpOtxYo&q=85&s=67e5f63303190b8c121d104b07fecb01" alt="Image showing a result of an automated step" width="2940" height="1670" data-path="images/docs/70d6117-automated.png" />
</Frame>

## Completing steps using API

You can also use our [API to complete steps](/reference/instances_complete_step).

Use the following information to structure your calls:

### Field with a simple input form field

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {
           "action_id":"FORM_FIELD_ID",
           "input_object":{
              "inputValue":"STRING"
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with an address input

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        { "action_id":"FORM_FIELD_1_ID",
          "input_object":{
                 "city":"city",
                 "street":"street",
                 "zipCode":"zipCode"
           } 
        }
     ]
  }
  ```
</CodeGroup>

### Field with a date input

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
              "date":"2021-06-16T10:00:00.000Z" 
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with a number

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
              "numberValue": 10000, //can also be 0 or null (empty field)
              "formattedValue": "" //can be left empty. If formatting has been configured in the editor, it will be automatically applied to the value. 
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with a checklist

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
                 "itemsChecked":[
                    "Option A",
                    "Option B"
                 ]
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with radio button selection

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
              "radioItemSelected":"Option A"
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with URL input

<CodeGroup>
  ```json JSON theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
              "url":{
                 "url":"http://nextmatter.com"
              }
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with email input

<CodeGroup>
  ```json theme={null}
  {
      "step_id": "STEP_ID",
      "actions": [
          {"action_id":"FORM_FIELD_ID",
           "input_object": {
                  "emailValue": "[email protected]"
              }
          }
      ]
  }
  ```
</CodeGroup>

### Field with a drawing

<CodeGroup>
  ```json theme={null}
  {
     "step_id": "STEP_ID",
     "actions": [
        {"action_id":"FORM_FIELD_ID",
         "input_object": {
              "url": "https://MY_IMAGE_URL.png"
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with image upload

<CodeGroup>
  ```json theme={null}
  {
     "step_id": "STEP_ID",
     "actions": [
        {"action_id":"FORM_FIELD_ID",
         "input_object": {
              "images": "https://MY_IMAGE_URL.png"
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with file upload

<CodeGroup>
  ```json theme={null}
  {
     "step_id": "STEP_ID",
     "actions": [
        {"action_id":"FORM_FIELD_ID",
         "input_object": {
              "files": "https://MY_FILE_URL.txt"
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with user selection dropdown

<CodeGroup>
  ```json theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
           "input_object":{
               "selection":{
                   "user_email":"[email protected]"
                 }  
           }
        }
     ]
  }
  ```
</CodeGroup>

### Field with user selection dropdown (team as assignee)

<CodeGroup>
  ```json theme={null}
  {
      "step_id": "STEP_ID",
      "actions": [
          {"action_id":"FORM_FIELD_ID",
           "input_object": {
                  "selection": {
                      "team_id": 1234
                  }
              }
          }
      ]
  }
  ```
</CodeGroup>

### Instruction

<CodeGroup>
  ```json theme={null}
  {
     "step_id":"STEP_ID",
     "actions":[
        {"action_id":"FORM_FIELD_ID",
         "input_object":{
           }
        }
     ]
  }
  ```
</CodeGroup>

### Routing

#### Return to step

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "ACTIVE_STEP_ID",
    "actions": [
      {
        "action_id": "FORM_FIELD_ID",
        "input_object": {
          "action": "return",
          "comment": "comment_text",
          "label": "UI_button_label", //leave as "" if there is no label change
          "returnToStep": "STEP_TO_RETURN_TO_ID"
        }
      }
    ]
  }
  ```
</CodeGroup>

#### Skip forward (to step)

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "ACTIVE_STEP_ID",
    "actions": [
      {
        "action_id": "FORM_FIELD_ID",
        "input_object": {
          "action": "skip_forward",
          "comment": "comment_text",
          "label": "UI_button_label", //leave as "" if there is no label change
          "returnToStep": "STEP_TO_SKIP_TO_ID"
        }
      }
    ]
  }
  ```
</CodeGroup>

#### Stop instance

Note that when an instance is stopped using routing, the complete step endpoint response will contain `aborted_time` instead of `completed_time`.

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "ACTIVE_STEP_ID",
    "actions": [
      {
        "action_id": "FORM_FIELD_ID",
        "input_object": {
          "action": "decline",
          "comment": "comment_text",
          "label": "UI_button_label", //leave as "" if there is no label change
          "returnToStep": -2
        }
      }
    ]
  }
  ```
</CodeGroup>

#### Continue

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "ACTIVE_STEP_ID",
    "actions": [
      {
        "action_id": "FORM_FIELD_ID",
        "input_object": {
          "action": "complete",
          "comment": "comment_text",
          "label": "UI_button_label", //leave as "" if there is no label change
          "returnToStep": -1
        }
      }
    ]
  }
  ```
</CodeGroup>

#### Save a step with a routing button, without selecting any option

(Step is optional, or the goal is to only save)

<CodeGroup>
  ```json theme={null}
  {
         "step_id":"ACTIVE_STEP_ID", 
         "mode":"save",
         "actions":[
                  {
        "action_id":  "FORM_FIELD_ID",
        "input_object": {
          "label":"",
          "action": "",
          "comment": "",
          "returnToStep": 0
        }
      }
   ]
  }
  ```
</CodeGroup>

### Single-select dropdown (with and without dataset as source)

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "ACTIVE_STEP_ID",
    "actions": [
      {
        "input_object": {
          "itemSelected": "NAME_OF_SELECTED_ITEM"
        },
        "action_id": "FORM_FIELD_ID"
      }
    ]
  }
  ```
</CodeGroup>

### Multi-select dropdown

#### Minimal request

<CodeGroup>
  ```json theme={null}
  {
    "step_id": ACTIVE_STEP_ID,
    "actions": [
      {
        "input_object": {
          "itemsSelected": ["NAME_OF_SELECTED_ITEM", "NAME_OF_SELECTED_ITEM"]
        },
        "action_id": "FORM_FIELD_ID"
      }
    ]
  }
  ```
</CodeGroup>

#### Full request

<CodeGroup>
  ```json theme={null}
  {
    "step_id": ACTIVE_STEP_ID,
    "actions": [
      {
        "input_object": {
          "allItems": [], //enter all available items or leave empty
          "itemsSelected": ["NAME_OF_SELECTED_ITEM", "NAME_OF_SELECTED_ITEM"],
          "itemsNotSelected": ["NAME_OF_NOT_SELECTED_ITEM"],
          "numberOfItemsSelected": 2, 
          "numberOfItemsNotSelected": 1
        },
        "action_id": "FORM_FIELD_ID"
      }
    ]
  }
  ```
</CodeGroup>

### Table

Ensure that the table content in `jsonResult` is a **JSON-encoded string representation** of the 2D array.

<CodeGroup>
  ```json theme={null}
  {
  "step_id": "ACTIVE_STEP_ID",
  "actions": [
    {
      "action_id": "FORM_FIELD_ID",
      "input_object": {
        "jsonResult": "[[\"HeaderRow1Column1Value\", \"HeaderRow1Column2Value\", \"HeaderRow1Column3Value\"], [\"Row2Column1Value\", \"Row2Column2Value\", \"Row2Column3Value\"], [\"Row3Column1Value\", \"Row3Column2Value\", \"Row3Column3Value\"]]"
      }
    }
  ]
  }
  ```
</CodeGroup>

<Info>
  Note that when the provided values are numbers (like the values in column 2 of the above examples), they don't need to be escaped (`\"\"`). For an empty field, escape it with no values provided.
</Info>

**Real-life call example**

<Frame>
  <img src="https://mintcdn.com/nextmatter/SgcAiYe3VpK6bFPP/images/docs/b232a5c1b2f570839f42aa7715322816c8817583883a6c9b3774ee2a28bc70db-postman.png?fit=max&auto=format&n=SgcAiYe3VpK6bFPP&q=85&s=ae016ce2b25040d382d55cc4c9774035" alt="Image showing JSON body of a call" width="1982" height="430" data-path="images/docs/b232a5c1b2f570839f42aa7715322816c8817583883a6c9b3774ee2a28bc70db-postman.png" />
</Frame>

**1**: These will be header names for the 3 columns we're creating. This will be our first row. Note: If you don't want to create a header with specific names, go to the table configuration and clear the **Set first row as header** option. Then your header will get default names.

<img src="https://mintcdn.com/nextmatter/bsmXZ466WcpOtxYo/images/docs/5613deb60e166b9741b27230d343fbc001ddda821acbfe4c49cf80470a7a1bb1-Screenshot_2024-11-08_at_15.27.42.png?fit=max&auto=format&n=bsmXZ466WcpOtxYo&q=85&s=67cd85285c037a1830ea57f30e531286" alt="Image showing how the JSON above maps onto a form table" width="1122" height="534" data-path="images/docs/5613deb60e166b9741b27230d343fbc001ddda821acbfe4c49cf80470a7a1bb1-Screenshot_2024-11-08_at_15.27.42.png" />

**2**: These values will appear in the 2nd row in the respective columns.

**3**: The 3rd column of the 3nd row will be empty.

**4**: This is my step ID

**5**: This is my form field ID.

### Completing conditional steps

To write a complete step request when some input [form fields are conditional](/docs/set-conditions-to-a-step#set-form-field-conditions), you need to include all the fields in the request body, regardless of whether they are conditional. For conditional fields, simply provide empty values.

For example:

<CodeGroup>
  ```json theme={null}
  {
    "step_id": "STEP_ID",
    "actions": [
      {
        "action_id": "FORM_FIELD_1_ID",
        "input_object": {
          "selection":{
                   "user_email":"[email protected]"
                 } 
        }
      },
      {
        "action_id": "FORM_FIELD_2_ID",
        "input_object": {
          "images": []
        }
      }
    ]
  }
  ```
</CodeGroup>
