Update Values of Custom Fields for Inventory Documents catalog.userfield.document.update
We are still updating this page
Some data may be missing — we will complete it shortly.
Scope:
catalogWho can execute the method: any user
catalog.userfield.document.update(documentId, fields)
This method updates the values of custom fields for inventory documents.
Parameters
|
Parameter |
Description |
|
|
documentId |
Identifier of the inventory document. |
|
|
fields |
Fields to be updated and their new values. |
Required parameters are marked with *
Example
In the API, field names are represented as field[Field ID in the database] – for example, field287. The field ID can be obtained using the method userfieldconfig.list.
JS
PHP
BX24.js
try
{
const response = await $b24.callMethod(
'catalog.userfield.document.update',
{
documentId: 64,
fields: {
'documentType': 'S',
'field287': 'new value'
}
}
);
const result = response.getData().result;
console.log(result);
}
catch( error )
{
console.error(error.ex);
}
try {
$response = $b24Service
->core
->call(
'catalog.userfield.document.update',
[
'documentId' => 64,
'fields' => [
'documentType' => 'S',
'field287' => 'new value'
]
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
error_log($result->error()->ex);
} else {
echo 'Success: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error updating document user field: ' . $e->getMessage();
}
BX24.callMethod(
'catalog.userfield.document.update',
{
documentId: 64,
fields: {
'documentType': 'S',
'field287': 'new value'
}
},
function(result)
{
if(result.error())
console.error(result.error().ex);
else
console.log(result.data());
}
);
How to Use Examples in Documentation
Copied
Previous