# 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.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yansalabs.com/jira-integration-framework/technical-docs/spoke-actions/additional-information-payload-add-attribute.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
