# Set tag value

This is a pre-built Action located under the **WebService Element**. The functionality of this Action in Avo Assure is to set the value of a specific tag (XML or JSON tag value) within the request body of the WebService. The result of this Action updates the request body dynamically for further use during test execution.

## Syntax

**Input Value**: `Tag Value`&#x20;

{% hint style="info" %}
**Supported Input Formats**:

* **Text**: Plain string input.
* **Static Value**: A fixed value that you manually provide.
* **Dynamic Variable**: Value retrieved from a previously stored output variable.
  {% endhint %}

| Argument                       | Description                                                                                    |
| ------------------------------ | ---------------------------------------------------------------------------------------------- |
| <p>Tag Value<br>(Required)</p> | Enter the value that needs to be assigned to the specified tag in the Webservice request body. |

**Output Value**: `N/A`

| Argument | Description    |
| -------- | -------------- |
| N/A      | Not Applicable |

{% hint style="info" %}
**Note:** To use the **Set tag value** action, drag and drop the Webservice element from the Element Repository to the Test case. The **Element Name**, **Action** (Keyword), and **Input Value** fields display automatically. The **Set tag value** action becomes available at the Test case level only after the element is added.
{% endhint %}

### Example 1: Setting a Tag Value in a Webservice Request

In this example, we explain how to update or insert a JSON tag value in a Webservice request body.

* **Action**: Set tag value
* **Input Value**: John
  * The input value (**John**) specifies the value that is assigned to the JSON tag.
  * The action updates or inserts the **first\_name** tag in the Webservice request body with the provided value.
* **Output Value**: N/A
  * This action does not require any output value.&#x20;
* **Logical Explanation**: The **Set tag value** action takes the value from the **Input Value** column (**John**) and assigns it to the **first\_name** JSON tag in the Webservice request body. This action modifies the request body directly.

<figure><img src="/files/jRYzrMp8pBsIKrjjHfmK" alt=""><figcaption></figcaption></figure>

### Example 2: Setting a Tag Value Using a Dynamic Variable

In this example, we explain how to set a JSON tag value using a dynamic variable.

* **Action:** Set tag value
* **Input Value:** {FirstName}
  * The input value (**{FirstName}**) specifies a dynamic variable that stores the value to assign to the JSON tag.
  * The action retrieves the value stored in the **{FirstName}** variable and assigns it to the **first\_name** tag in the Webservice request body.
* **Output Value:** N/A
  * This action does not require any output variable.
* **Logical Explanation:** The **Set tag value** action takes the value from the **Input Value** column (**{FirstName}**). It fetches the value stored inside the dynamic variable and assigns it to the **first\_name** JSON tag.&#x20;

{% hint style="info" %}
To know more how to create a dynamic variable in Avo Assure, [click here](/avo-assure/actions/generic/variable-operations/create-dynamic-variable.md).
{% endhint %}

<figure><img src="/files/ze4GIN75xqRlXgTQiqDE" alt=""><figcaption></figcaption></figure>

### Example 3: Setting a Tag Value Using a Data Parameterized Value

In this example, we explain how to set a JSON tag value using a data parameterized value from a data source.

* **Action:** Set tag value
* **Input Value:** |FirstName|
  * The input value (**|FirstName|**) specifies a data parameterized field that retrieves its value from an external data source (such as Excel, or Data Table).
  * The action reads the corresponding value for the current iteration and assigns it to the **first\_name** tag in the Webservice request body.
* **Output Value:** N/A
  * This action does not require or store any output variable.
* **Logical Explanation**: The **Set tag value** action takes the value given in the **Input Value** column (**|FirstName|**). It gets the data (John) from the data source. Then, it sets that value to the **first\_name** JSON tag in the request body.

{% hint style="info" %}
To know more how to do **Data Parameterization**, [click here](/avo-assure/utilities/data-parametrization.md).
{% endhint %}

<figure><img src="/files/KrXOGkFX59wjULsNnlFA" alt=""><figcaption></figcaption></figure>

### Example 4: Setting an XML Tag Value Using a Static Value

In this example, we explain how to set an XML tag value using a static (hardcoded) value.

* **Action:** Set tag value
* **Input Value:** John
  * The input value (**John**) specifies a static value entered directly in the Input Value column.
  * The action assigns this fixed value to the **OrderRequest/Customer/first\_name** XML tag in the request body.
* **Output Value:** N/A
  * This action does not require or store any output variable.
* **Logical Explanation:** The **Set tag value** action takes the value from the **Input Value** column (**John**) and assigns it directly to the specified XML tag (**OrderRequest/Customer/first\_name**).

<figure><img src="/files/EYiDd2BnpgyYMqmJQXmJ" alt=""><figcaption></figcaption></figure>


---

# 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.avoautomation.com/avo-assure/actions/web-service-operations/web-service-elements/set-tag-value.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.
