Answer the question
In order to leave comments, you need to log in
Why does the Fetch() method in an arbitrary php code of the Bitrix24 business process not return false?
Why does the Fetch() method in an arbitrary php code of the Bitrix24 business process not return false?
The same method, if used not in a Business process, but simply in a php file, works as it should - if there is no data, it returns false.
$rootActivity = $this -> GetRootActivity();
$em = $rootActivity->GetVariable("EMAIL_WORK");
$rs = CCrmFieldMulti::GetList(
array(),
array(
'ENTITY_ID' => 'LEAD',
'VALUE' =>$em ,
'COMPLEX_ID' => 'EMAIL_WORK'
)
);
if ($rs->Fetch()) {
$rootActivity->SetVariable("isDubleCQ",1);
} else {
$rootActivity->SetVariable("isDubleCQ",0);
}
Answer the question
In order to leave comments, you need to log in
It seems to me that the problem is not in the fetch method. The main question is what is in the $em variable at the time the elements are found.
You know that if $em = true, it's the same as $em = 1, but if $em = false it won't find anything.
After assigning $em, add the following code:
ob_start();
echo "<pre>";
var_dump( array(
'ENTITY_ID' => 'LEAD',
'VALUE' =>$em ,
'COMPLEX_ID' => 'EMAIL_WORK'
));
file_put_contents($_SERVER['DOCUMENT_ROOT'].'/test_bp_val.txt', ob_get_clean(), FILE_APPEND);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question