update_custom_field

To create, update, or delete a custom field of an item, use the item/update_custom_field method. To send a request, you should have the View custom fields and Manage custom fields access rights to the item.

Endpoint

Copied!
svc=item/update_custom_field&params={
  "itemId":<long>,
  "id":<long>,
  "callMode":"<text>",
  "n":"<text>",
  "v":"<text>"
}

Parameters

The request must contain the following parameters:

Parameter Description
itemId Item ID.
id Custom field ID. When creating a custom field, specify any value, for example, 0. The system ignores it and assigns the smallest free ID within the item (1, 2, and so on). IDs of deleted fields are reused.
callMode Action: create, update, or delete.

To create or update a custom field, also specify the following parameters:

Parameter Description
n Custom field name.
v Custom field value.

Returned result

If a custom field is created or updated successfully, a response in the following format is returned:

Copied!
[
	<long>,			/* custom field ID */
	{
		"id":<long>,	/* custom field ID */
		"n":"<text>",	/* name */
		"v":"<text>",	/* value */
		"ct":<uint>,	/* creation time (Unix timestamp) */
		"mt":<uint>	/* last modification time (Unix timestamp) */
	}
]

If a custom field is deleted successfully, a response in the following format is returned:

Copied!
[
	<long>,	/* custom field ID */
	null
]

Otherwise, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters. For example, callMode has an unsupported value, or the custom field to update isn’t found.
6 Failed to create the custom field, or the custom field to delete isn’t found.
7 Failed to fetch the item. The user may not have the View custom fields and Manage custom fields access rights to the item.

If you find a mistake in the text, please select it and press Ctrl+Enter.