Thank you Yuri.
I will stick to the workaround.
findRelatedMany not finding all related records?
Collapse
X
-
Call attendees were always stored in that relationship. Migrating from the parent to participants would not be a right thing to do. We should not touch attendees, it's business data.
We already have a separate link in the Lead (and Contact) for the Meeting/Call's Parent field, added a few days ago. Before, we had only for the attendee.Leave a comment:
-
Ok, after some digging I think I've found the issue:
This call was created in 2024.
In 2024 Espo probably did not populate the leadsIds field, but only the parentId (probably that field did not even exist in the past)
This is why findRelatedMany is not working for records created way in the past.
Maybe a migration script should take care of backfilling this data?Leave a comment:
-
findRelatedMany not finding all related records?
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.13Last edited by Kharg; 04-30-2026, 09:56 PM.Tags: None

Leave a comment: