> For the complete documentation index, see [llms.txt](https://docs.yansalabs.com/jira-integration-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yansalabs.com/jira-integration-framework/technical-docs/spoke-actions/additional-information-payload-add-attribute.md).

# Additional Information Payload - Add Attribute

## Summary

Adds a new attribute to the Issue's "Additional Information" payload (a JSON string), and returns the modified payload. Supports dot notation to add nested attributes and allows the value to be treated as either a plain string or JSON-parsed object.

***

## Action Inputs

| Label            | Name               | Type   | Mandatory | Description                                                                                                                    |
| ---------------- | ------------------ | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Existing Payload | `existing_payload` | String | No        | The current JSON-formatted issue body to be modified. If not provided, an empty object is used as the base.                    |
| Attribute Name   | `attribute_name`   | String | Yes       | The name of the attribute to add. Dot notation (e.g., `fields.labels`) will create nested objects within the payload.          |
| Value            | `value`            | String | No        | The value to assign to the specified attribute.                                                                                |
| Value Type       | `value_type`       | Choice | Yes       | Specifies how to interpret the value: `"string"` stores the value as-is, while `"JSON"` parses it into an object or primitive. |

***

## Action Outputs

| Label         | Name                | Type       | Description                                                           |
| ------------- | ------------------- | ---------- | --------------------------------------------------------------------- |
| Success       | `success`           | True/False | Indicates whether the action completed without error.                 |
| New Payload   | `new_payload`       | String     | The resulting JSON string with the new or updated attribute.          |
| Error Message | `error_message`     | String     | A message describing any error that occurred, or blank if successful. |
| Action Status | `__action_status__` | Object     | Standard IntegrationHub status object (automatically included).       |

***

## Example Usage

***

### Example 1: Add a simple string field

**Existing Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "issuetype": {
      "id": "10001"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

**Inputs:**

```json
{
  "attribute_name": "fields.customfield_10033",
  "value": "434304373",
  "value_type": "string"
}
```

**Resulting Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "customfield_10033": "434304373",
    "issuetype": {
      "id": "10001"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

***

### Example 2: Add an array as a field (JSON value)

**Existing Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "issuetype": {
      "id": "10001"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

**Inputs:**

```json
{
  "attribute_name": "fields.labels",
  "value": "[\"ServiceNow_Integration\"]",
  "value_type": "JSON"
}
```

**Resulting Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "labels": [
      "ServiceNow_Integration"
    ],
    "issuetype": {
      "id": "10001"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

***

### Example 3: Modify an existing nested attribute

**Existing Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "issuetype": {
      "id": "10001"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

**Inputs:**

```json
{
  "attribute_name": "fields.issuetype.id",
  "value": "10002",
  "value_type": "string"
}
```

**Resulting Payload:**

```json
{
  "fields": {
    "summary": "Unable to post content on a Wiki page",
    "description": "I am not able to edit a wiki page.",
    "issuetype": {
      "id": "10002"
    },
    "project": {
      "id": "10000"
    }
  },
  "update": {}
}
```

***

## Notes

* If `existing_payload` is invalid JSON, the action will return `success: false` and provide a descriptive `error_message`.
* When `value_type` is `"JSON"`, the `value` must be valid JSON (e.g., objects, arrays, numbers, booleans).
* This action is commonly used to extend the body of outbound issue or ticket payloads prior to submission to external systems.
