Documentation

crm.type.update

Scope: catalog Permissions to execute: administrator

Description and parameters

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

Method updates existing SPA settings with ID.


Parameters

Parameter Description
idSPA ID.
fieldsConsist of SPA settings fields, as well as binding settings, custom field settings and display settings outside of CRM.

Update only individual SPA field settings

To update only individual SPA field settings, pass the updated fields values only. For example, disable document print feature:

{
  "id": 128,
  "fields": {
    "isDocumentsEnabled": "N"
  }
}

Update binding settings

You can find more details on binding settings here.

To update SPA binding settings, pass data using the key relations.

  • Settings must be passed completely, they are overwritten fully.
  • You cannot update preset binding settings (iPredefined: true). You may skip these settings in the query.

Enabling "Client" complex field creates preset bindings to Companies and Contacts.

{
  "id": 128,
  "fields": {
    "relations": {
      "parent": [
        {
          "entityTypeId": 130
        }
      ],
      "child": [
        {
          "entityTypeId": 130,
          "isChildrenListEnabled": "N"
        }
      ]
    }
  }
}

The system writes false inside the setting isChildrenListEnabled, if not passed. The key iPredefined cannot be passed.

When attempting to save passed settings, an error occurs, it won't be printed. Settings just won't be saved.


Update display settings outside of CRM

You can find more details on settings outside of CRM here.

Set of additional section must be passed completely.

For example, set of section looks as follows at the moment (as response to crm.type.get):

{
  "type": {
    "customSections": [
      {
        "id": 18,
        "title": "Manufacturing",
        "iSelected": "N"
      },
      {
        "id": 20,
        "title": "HR",
        "iSelected": "N"
      }
    ]
  }
}

You need to list "HR" as the first, delete section "Manufacturing", and create a new "Consuming" section instead and bind SPA to it.

In this case, the query will look as follows:

{
  "id": 128,
  "fields": {
    "customSections": [
      {
        "id": 20,
        "title": "HR"
      },
      {
        "id": "new_1",
        "title": "Consuming"
      }
    ],
    "customSectionId": "new_1"
  }
}
© «Bitrix24», 2001-2024