S
S
sagaton2021-11-09 19:52:10
1C-Bitrix
sagaton, 2021-11-09 19:52:10

How to enter data into a property of the API reference type?

How to enter data into a property of the API reference type?
I tried it like this
$arFields["VALUES"][0] = Array(
"XML_ID" => "NEBO",
"VALUE" => "Sky",
"DEF" => "Y",
"SORT" => "100 ",
'DEF' = I tried to change xml but nothing came out.
Tell me how to add an element/elements to the list type.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Zhitnik, 2021-11-11
@sagaton

The directory is a highloadblock. We fill in as usual:

const MY_HL_BLOCK_ID = 1;
CModule::IncludeModule('highloadblock');
$entity_data_class = GetEntityDataClass(MY_HL_BLOCK_ID);
$result = $entity_data_class::add(array(
      'UF_NAME'         => 'Желтый',
      'UF_XML_ID'      => 'YELLOW',
     ...
   ));

Then, when writing the value of the infoblock property, we use UF_XML_ID, that is, 'YELLOW'.

S
sagaton, 2021-11-09
@sagaton

The property itself is created like this
$arFields = Array(
"NAME" => "Seasons" ,
"ACTIVE" => "Y" ,
"SORT" => "50" ,
"CODE" => "Seasons" ,
"PROPERTY_TYPE" => "S" ,
"USER_TYPE" => "directory" ,
"IBLOCK_ID" => 2 ,
"LIST_TYPE" => "L" ,
"MULTIPLE" => "Y" ,
'IS_REQUIRED' => 'Y',
'SMART_FILTER' => "Y",
"USER_TYPE_SETTINGS" => array("size"=>"1", "width"=>"0", "group"=>"N", "multiple"=>"Y", "TABLE_NAME"=>"b_seasons" )
But TABLE_NAME"=>"b_seasons"
is not assigned to the 'Directory Name' field, perhaps that's why you can't add elements.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question