Create Data Storage entity.add

We are still updating this page

Some data may be missing here — we will fill it in shortly.

Scope: entity

Who can execute the method: any user

The entity.add method creates a data storage. Before creating, you can check for the existence of the storage using entity.get.

Parameters

Parameter

Description

ENTITY*
string

Required. String identifier of the storage, unique for this application (maximum length - 13 characters).

NAME*
string

Required. Name of the storage.

ACCESS
unknown

Description of access permissions for the storage.
It should be in the form of an associative array, where the keys are the identifiers of access permissions, and the values are R (read), W (write), or X (manage).

Required parameters are marked with *

The Creator of the storage automatically receives X permission.

Example

try
        {
        	const response = await $b24.callMethod(
        		'entity.add',
        		{
        			'ENTITY': 'dish',
        			'NAME': 'Dishes',
        			'ACCESS': {
        				U1:'W',
        				AU:'R'
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.log('Created element with ID:', result);
        	// Your required data processing logic
        	processResult(result);
        }
        catch( error )
        {
        	console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'entity.add',
                    [
                        'ENTITY' => 'dish',
                        'NAME'   => 'Dishes',
                        'ACCESS' => [
                            'U1' => 'W',
                            'AU' => 'R'
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your required data processing logic
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error adding entity: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'entity.add',
            {
                'ENTITY': 'dish',
                'NAME': 'Dishes',
                'ACCESS': {
                    U1:'W',
                    AU:'R'
                }
            }
        );
        

How to Use Examples in Documentation