Documentation

crm.item.update

Scope: catalog Permissions to execute: for all

Description and parameters

crm.item.update({entityTypeId: number, id: number, fields: {})

Method updates item with id for SPA with entityTypeId.

Standard checks, modifications and automatic actions are performed upon updating an item:

  • access permissions;
  • completed required fields, if item stage updated within the same category/pipeline;
  • stage-dependent required fields, if item stage updated within the same category/pipeline;
  • correct field data is checked;
  • fields are assigned default values;
  • no saving, if field changes failed to implement prior to saving;
  • automation rules are launched after saving .

Method returns result similar to the method crm.item.get for updated item.

Parameters

Parameter Description
entityTypeIdSPA ID.
idItem ID.
fieldsItem field value.

Upload new file instead of the old one (non-multiple field)

To replace file in the non-multiple field, just upload new file. Old file will be deleted automatically.

{
    "fields": {
        "ufCrm1617027453943": [
             "myfile.pdf", 
             "...base64_encoded_file_content..."
        ]
    }
}

Delete file-type custom field



You need just pass an empty string ('') instead of a value

Leave non-multiple file field without changes

The simplest option: do not add key with this field into fields. However, if you need to pass it without changing, pass the list as a value with such file ID in the id key

{
    "fields": {
        "ufCrm1617027453943": {
            "id": 433    
        }
    }
}

Passing a value, different from the current value into id - resets field value to zero and the file will be erased.

Handling file-type multiple field

Multiple field value - is an array. Each array element is subject to the same rules that apply to non-multiple values.

Partial overwriting value for multiple file-type field

For example, currently multiple file-type field contains the value [12, 255, 44].

We need to keep 12 and 44, and upload a new file instead of 255

The query must look as follows:

{
    "fields": {
        "ufCrm1617027453943": [
              {
                  "id": 12
              },
              {
                  "id": 44
              },
              [
                   "myNewFile.pdf", 
                   "...base64_encoded_file_content..."
              ]
        ]
    }
}
© «Bitrix24», 2001-2024