# setAttribute

## Description

Sets an object’s attribute.

## Input / Parameter

| Name      | Description                         | Input Type | Default | Options | Required |
| --------- | ----------------------------------- | ---------- | ------- | ------- | -------- |
| object    | The object to set attribute for.    | Object     | -       | -       | Yes      |
| attribute | The attribute to set.               | String     | -       | -       | Yes      |
| value     | The value to set for the attribute. | Any        | -       | -       | Yes      |

## Output

| Description            | Output Type |
| ---------------------- | ----------- |
| Returns true or false. | Boolean     |

## Example

In this example, we will add new attribute to an object and check the resulting object in the console.

### Step

1. Drag a `button` component into the canvas and open the `Action` tab. Select the `press` event of the button.

   ![](/files/jXTw4KVoGogvUBfB8g1N)
2. Drag the `Variable.set` function to the event flow and change it's `name` param value to `originalObject`, and it's `value` param type to funtion / subflow. Inside `value` subflow add `Conversion.toObject` function and add two new paremeter `value1` and `value2` with their value as `val1` and `val2`.

   ![](/files/vjkLGVpkqec0mmyMnuTB)
3. Back to the main flow add the `Object.setAttribute` function, on it's `attribute` and `value` param add `newValue` as a value for both of them and change it's `object` parameter type to a function / subflow, inside it drag a `Variable.get` function and then fill it's `name` param value with `originalObject`.

   ![](/files/i41SPIUSxL3b3KhXBYxU)
4. Back to the main flow add the `Log.write` function and change it's `value` parameter type to a function / subflow, inside it drag a `Object.getAttribute` function and then fill it's `attribute` param value with `newValue` as for it's `object` param, change the param type into a function / subflow and add the `Varable.get` function inside, on it's `name` param add `originalObject` as the value.

   ![](/files/8Q4ohhfoZD7w9O9gKchZ)

### Result

1. This steps will show us the updated object attribute based on it's new parameter and value on the console.

   ![](/files/V6tgXih89dWR8hGvxb2J)

### Related Information

See also

* Functions
  * [Variable.get](/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/variable/get.md)
  * [Variable.set](/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/variable/set.md)
  * [Object.getAttribute](/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/object/getattribute.md)
  * [Conversion.toObject](/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/conversion/toobject.md)
  * [Log.write](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/006-actions-and-visual-logic/action-reference/react-native/Log/write.md)


---

# 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.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/object/setattribute.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.
