# Update Set-Field Action

Updates an automation set-field action's contact field or write operation for future runs; existing contact values stay. Omitted settings stay; supplied lists replace prior lists. Requires an unscheduled, inactive automation and its current revision from get-automation; dryRun previews without saving.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "automationId": {
      "type": "integer",
      "minimum": 1
    },
    "actionId": {
      "type": "integer",
      "minimum": 1
    },
    "revision": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "settings": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 250
        },
        "color": {
          "type": "string",
          "enum": [
            "",
            "teal-light",
            "peach-light",
            "pink-light",
            "violet-light",
            "blue-light",
            "silver-light",
            "brown-light",
            "yellow-light",
            "green-light",
            "coldgreen-light",
            "teal-dark",
            "peach-dark",
            "pink-dark",
            "violet-dark",
            "blue-dark",
            "silver-dark",
            "brown-dark",
            "yellow-dark",
            "green-dark",
            "coldgreen-dark"
          ],
          "description": "Card colour from the editor palette, e.g. green-dark or blue-light. An empty string uses the default colour of the action type."
        },
        "customFieldID": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "customFieldOp": {
          "type": "string",
          "enum": [
            "set field value",
            "copy from field",
            "copy from subscriber",
            "empty field",
            "prepend string",
            "append string",
            "replace string",
            "generate CRC32 hash",
            "generate MD5 hash",
            "generate SHA1 hash",
            "generate SHA256 hash",
            "generate SHA384 hash",
            "generate SHA512 hash",
            "add number",
            "subtract number",
            "random number",
            "truncate url query",
            "truncate url path",
            "datetime now",
            "datetime increase",
            "datetime decrease",
            "now next month",
            "now next year",
            "field next month",
            "field next year",
            "ultimo",
            "easter date",
            "time now",
            "floor full hour",
            "ceil full hour",
            "round full hour"
          ]
        },
        "customFieldValue": {
          "type": "string",
          "maxLength": 1000,
          "description": "For \"set field value\": a date as YYYY-MM-DD, a time as HH:MM, a date and time as YYYY-MM-DD HH:MM (no seconds, no time zone). For \"datetime now/increase/decrease\": the amount and unit, e.g. \"+3 days\" (units minutes, hours, days, weeks, month, years), on a date-and-time field followed by HH:MM when customFieldValue2 is \"set field value\". A changed operation starts from empty values."
        },
        "customFieldValue2": {
          "type": "string",
          "maxLength": 1000,
          "description": "For \"datetime now/increase/decrease\" on a date-and-time field, the time: \"datetime now\" (keep the current time), \"set field value\" (the time in customFieldValue), \"round full hour\", \"floor full hour\" or \"ceil full hour\"."
        },
        "delayDayOfWeek": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          },
          "uniqueItems": true,
          "minItems": 1,
          "maxItems": 7,
          "description": "For \"datetime now/increase/decrease\": the weekdays (1 Monday to 7 Sunday) the calculated date may fall on; it moves on a day until it does. Omit for all seven."
        }
      }
    },
    "dryRun": {
      "type": "boolean",
      "default": false
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "automationId",
    "actionId",
    "revision",
    "settings"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "automationId",
    "name",
    "revision",
    "status",
    "editorUrl",
    "graph",
    "findings",
    "editable",
    "dryRun",
    "settings",
    "splitTests"
  ],
  "properties": {
    "automationId": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "revision": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "editorUrl": {
      "type": "string"
    },
    "graph": {
      "type": "object",
      "required": [
        "start",
        "goals",
        "states"
      ],
      "properties": {
        "start": {
          "type": "integer"
        },
        "goals": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "states": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "type",
              "next",
              "nextNo"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "type": {
                "type": "string"
              },
              "next": {
                "type": "integer"
              },
              "nextNo": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "actionId",
          "code",
          "message",
          "warning",
          "variantId"
        ],
        "properties": {
          "actionId": {
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "warning": {
            "type": "boolean"
          },
          "variantId": {
            "type": "integer"
          }
        }
      }
    },
    "editable": {
      "type": "boolean"
    },
    "dryRun": {
      "type": "boolean"
    },
    "settings": {
      "type": [
        "object",
        "array"
      ]
    },
    "splitTests": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "actionId",
          "id"
        ],
        "properties": {
          "actionId": {
            "type": "integer"
          },
          "id": {
            "type": "integer"
          },
          "missing": {
            "type": "boolean"
          },
          "revision": {
            "type": [
              "string",
              "null"
            ]
          },
          "durationSeconds": {
            "type": "integer"
          },
          "started": {
            "type": "integer"
          },
          "finished": {
            "type": "integer"
          },
          "winnerIndex": {
            "type": "integer"
          },
          "variants": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kind",
                "entityId",
                "weight",
                "goalTagId"
              ],
              "properties": {
                "kind": {
                  "type": "string"
                },
                "entityId": {
                  "type": "integer"
                },
                "weight": {
                  "type": "integer"
                },
                "goalTagId": {
                  "type": "integer"
                },
                "contactCount": {
                  "type": "integer"
                },
                "conversionCount": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}
```

