Y
Y
Yastr2015-12-09 21:40:38
PHP
Yastr, 2015-12-09 21:40:38

How to write a value to the custom field "megaplan" when creating a deal via api?

Hello!
Please tell me how I can record, among other things, the value of the custom field in the transaction.
There is a field with this id (Category1000055CustomFieldRoistat)

[32] => Array
    (
        [Name] => Category1000055CustomFieldRoistat
        [Translation] => roistat
    )

and the function that creates the deal
function create_deal($client, $desc) {
  global $request;

  $raw = $request->get(
      '/BumsTradeApiV01/Deal/save.api', array(

    'ProgramId' => 3,
    'StatusId' => 2,
    'StrictLogic' => false,

    'Model[Auditors]' => '1000008',
    'Model[Contractor]' => (int) $client,
    'Model[Contractor]' => (int) $client,
    'Model[Description]' => $desc

      )
  );
  return json_decode($raw, true);
}

having gone through the documentation, attempts to add my field to the array in a variety of variations did not give anything (the deal is created, the field is not filled)
in these ways I tried to cram it
...
    'Model[Description]' => $desc,

    "Model[Category1000055CustomFieldRoistat]" => $roistat
    "Category1000055CustomFieldRoistat" => $roistat,
    "CustomFieldRoistat" => $roistat,
    "Roistat" => $roistat,
    "roistat" => $roistat,
    "fields"  => array(
      "Category1000055CustomFieldRoistat" => $roistat,
    )

      )
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yastr, 2015-12-10
@Yastr

'Model[Category1000055CustomFieldRoistat]' => $roistat - working version, I don't understand how I could view it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question