# \_updateOneField

Update one stock field at a time.

### Parameters

#### id

Integer. ID of the stock item to update

#### field

String. The name of the field to be updated. Allowed fields:

* "name"
* "code"
* "is\_archived"
* "amt\_trigger"

#### val

String. The new value of the field being updated.

### Example

```
FM_api('Stock_updateOneField',
	[
		'id'=>'1',
		'field'=>'name',
		'val'=>'Test Item'
	]
);
```

### Result

```
{"ok":1}
```

### Errors

If you provide an invalid field name, you will receive an error:

```
{"error":"invalid field: xyz"}
```

If you provide an invalid or incorrectly formatted email address as part of the value of the amt\_trigger field, you will receive an error:

```
{"error":"invalid email address: potato"}
```


---

# 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.fieldmotion.com/fieldmotion-api-docs/stock/_updateonefield.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.
