I am on-site, v25.1.2 Ent
I have an After Relationship Add logic hook on Leads that calls an external function to do some work.
When the After Relationship Add event triggers, the Leads bean has the campaignID, the Arguments of the Logic Hook have the Related ID set to that campaignID, but the database does not yet have the campaign_id in the lead.
So the external API that is being called, which receives the LeadID as parameter and queries the leads table directly from the DB, does not see a campaign_id on the Lead record.
I checked in my logic hook by adding log statements and a DB query at the start of the after_relationship_add hook:
$GLOBALS['log']->fatal('related campaign from bean is' . $bean->campaign_id); $GLOBALS['log']->fatal('related campaign from logic_hook args is' . $arguments['related_id']); $GLOBALS['log']->fatal('related module ' . $arguments['related_module']); $query = 'SELECT campaign_id FROM leads WHERE id = ?'; $params = array($bean->id); $conn = $GLOBALS['db']->getConnection(); $stmt = $conn->executeQuery($query, $params); $results = $stmt->fetchAll(); $GLOBALS['log']->fatal('related campaign from db query is' . $results['campaign_id']);
and the Log confirms that the campaign_id is NOT on the lead when the after relationship add on Campaigns runs
Wed Oct 1 14:57:37 2025 [766][1][FATAL] event = after_relationship_add
Wed Oct 1 14:57:37 2025 [766][1][FATAL] related campaign from bean is1fc5ca18-4f09-11e8-b022-001a4a160206
Wed Oct 1 14:57:37 2025 [766][1][FATAL] related campaign from logic_hook args is1fc5ca18-4f09-11e8-b022-001a4a160206
Wed Oct 1 14:57:37 2025 [766][1][FATAL] related module Campaigns
Wed Oct 1 14:57:37 2025 [766][1][FATAL] rrelated campaign from db query is
I would expect the DB to be updated BEFORE the logic hook triggers...
Thoughts?
Thanks,
FrancescaS