A
A
alexander_chn2019-03-30 16:58:21
API
alexander_chn, 2019-03-30 16:58:21

How to enter data into the List property via Bitrix API 1-C?

Hello! How to add data to an ifnoblock that has a property of type List with the value:
XML_ID: Y
Value: Yes

$empty_field = "N";
  $filled_field = "Да";
       // $filled_field = "Y";

  !empty($_POST['girl']) ? $girl = $filled_field : $girl = $empty_field;
  !empty($_POST['boy']) ? $boy   = $filled_field : $boy  = $empty_field;
  !empty($_POST['gab']) ? $gab   = $filled_field : $gab  = $empty_field;

  CModule::IncludeModule('iblock');
  $el = new CIBlockElement;
  $iblock_id = 17;
  $section_id = false;

  $PROP = array();
  $PROP['ATT_SUBS_GIRL']  = $girl;
  $PROP['ATT_SUBS_BOY']   = $boy;
  $PROP['ATT_SUBS_GAB']   = $gab;

  $fields = array(
    "DATE_CREATE" => date("d.m.Y H:i:s"),
    "CREATED_BY" => $GLOBALS['USER']->GetID(),
    "IBLOCK_SECTION" => false,
    "IBLOCK_ID" => $iblock_id,
    "PROPERTY_VALUES" => $PROP,
    "NAME" => date("d.m.Y H:i:s"),
    "ACTIVE" => "Y"
  );
        if ( ! $el->Add($fields) ) {
    $result = false;
  }

Tell me in which direction to move? Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2019-03-31
@alexander_chn

As a property value of the "List" type, it must be passed to XML_ID, and ID.
5ca03b88124d6416139402.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question