> For the complete documentation index, see [llms.txt](https://manual.firstresonance.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.firstresonance.io/api/examples/automatically-updating-fields-in-runs.md).

# Automatically updating fields in runs

This is a guide showing how to update fields in runs from automated test equipment or analysis workflows.

## Get the fields

First thing you want to do is get the fields that exist in the run(s) you're trying to update:

{% tabs %}
{% tab title="Query" %}

```graphql
{
  run(id: 419) {
    id steps {
      id fields {
        id name value _etag
      }
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "run": {
      "id": 419,
      "steps": [
        {
          "id": 1429,
          "fields": [
            {
              "id": 1461,
              "name": "required_field",
              "value": null,
              "type": "STRING",
              "_etag": "066b1eb08dab44d6925d7bbd899e92cf"
            },
            {
              "id": 1462,
              "name": "pass_fail",
              "value": null,
              "type": "BOOLEAN",
              "_etag": "066b1eb08dab44d6925d7bbd899e92cf"
            },
            {
              "id": 1463,
              "name": "quality",
              "value": null,
              "type": "SIGNOFF",
              "_etag": "066b1eb08dab44d6925d7bbd899e92cf"
            }
          ]
        },
...
```

{% endtab %}
{% endtabs %}

This will return a list of steps within that run, and the fields within those steps. Find the field that you want to update. From the example response (Response tab) above, let's say we want to updated field `1462` because our test equipment is able to determine pass/fail easily. Here's the query you'll use:

```graphql
mutation {
  updateRunStepFieldValue(input: {
    id: 1462,
    value: true,
    etag: "066b1eb08dab44d6925d7bbd899e92cf"
  }) {
    runStepField {
      id value
    }
  }
}
```

What does this include? Because we're updating data, this is a `mutation` . The mutation we're using is called `updateRunStepFieldValue`. The id of the field is `1462` and the value we're setting is `true`. And finally, we'll include the `etag` of the original field. The `etag` prevent accidental data overwrites by enforcing concurrency control. After running the mutation, we'll get back the id and the updated value of the field in the response.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://manual.firstresonance.io/api/examples/automatically-updating-fields-in-runs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
