I think I am facing a difficult to reproduce bug (or an expected behavior?), I am not reporting this in the Bug Reports session as I was not able to reproduce in the official demo and this does not happen with all the leads/calls.
I am trying to find all the calls related to a Lead so that if the Lead gets reassigned all planned calls can be reassigned to the new assigned user as well.
However, when using record\findRelatedMany I am not able to find all related records but if I do the "inverse" search and use findMany instead, then I am able to find the planned linked records.
$ids = record\findRelatedMany('Lead', id, 'calls', 10, 'createdAt', 'desc', 'status=', 'Planned'); - will return an empty array
$ids = record\findRelatedMany('Lead', id, 'calls', 10, 'createdAt', 'desc', 'planned') - will also return an empty array
$ids = record\findMany('Call', 10, 'createdAt', 'desc', 'parentId=', id, 'status=', 'Planned', 'parentType=', 'Lead'); - will return the planned call
$ids = record\findRelatedMany('Lead', id, 'calls', 10); - will not return the planned call, only held/notHeld
Any idea why this may be happening?
The call is scheduled for 2041 and the call assigned user has been disabled in the CRM, but this does not seem to be the issue here.
Testing on
Espo 9.3.6
PHP 8.4.4
MariaDB 10.11.13
I am trying to find all the calls related to a Lead so that if the Lead gets reassigned all planned calls can be reassigned to the new assigned user as well.
However, when using record\findRelatedMany I am not able to find all related records but if I do the "inverse" search and use findMany instead, then I am able to find the planned linked records.
$ids = record\findRelatedMany('Lead', id, 'calls', 10, 'createdAt', 'desc', 'status=', 'Planned'); - will return an empty array
$ids = record\findRelatedMany('Lead', id, 'calls', 10, 'createdAt', 'desc', 'planned') - will also return an empty array
$ids = record\findMany('Call', 10, 'createdAt', 'desc', 'parentId=', id, 'status=', 'Planned', 'parentType=', 'Lead'); - will return the planned call
$ids = record\findRelatedMany('Lead', id, 'calls', 10); - will not return the planned call, only held/notHeld
Any idea why this may be happening?
The call is scheduled for 2041 and the call assigned user has been disabled in the CRM, but this does not seem to be the issue here.
Testing on
Espo 9.3.6
PHP 8.4.4
MariaDB 10.11.13

Comment