<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi all,<br />What you need it is very easy to do this, just add a simple trigger handler, here's an example:</p>
<p><a href="https://github.com/YetiForceCompany/YetiForceCRM/blob/master/include/utils/utils.php#L1646">https://github.com/YetiForceCompany/YetiForceCRM/blob/master/include/utils/utils.php#L1646</a></p>
<p>and</p>
<p><a href="https://github.com/YetiForceCompany/YetiForceCRM/blob/master/include/utils/utils.php#L1651">https://github.com/YetiForceCompany/YetiForceCRM/blob/master/include/utils/utils.php#L1651</a></p>
<div>---<br />
<p>Z poważaniem / Regards</p>
<div> </div>
<div><strong>Mariusz Krzaczkowski</strong></div>
<div><em>Director of Product Development</em></div>
<div>M: +48 884-998-123<br />E: <a title="Mail do Mariusz Krzaczkowski" href="mailto:m.krzaczkowski@yetiforce.com" rel="noreferrer">m.krzaczkowski@yetiforce.com</a></div>
<hr />
<p><span>We created an innovative open source project called YetiForceCRM. You can test it </span><a href="https://test.yetiforce.com/" rel="noreferrer">here</a><span>, </span><a href="https://github.com/YetiForceCompany/YetiForceCRM" rel="noreferrer">download</a><span> it for free or read its </span><a href="https://yetiforce.com/en/documentation.html" rel="noreferrer">documentation</a><span>. Follow us on </span><a href="https://twitter.com/YetiForceEN" rel="noreferrer">Twitter</a><span> to get real-time info about new functionalities and articles.</span></p>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th align="right" valign="baseline" nowrap="nowrap">Temat:</th>
<td>[Vtigercrm-developers] add/remove relatedlist entry trigger eventhandler</td>
</tr>
<tr>
<th align="right" valign="baseline" nowrap="nowrap">Data:</th>
<td>2015-05-21 18:17</td>
</tr>
<tr>
<th align="right" valign="baseline" nowrap="nowrap">Od:</th>
<td>Alan Lord <alanslists@gmail.com></td>
</tr>
<tr>
<th align="right" valign="baseline" nowrap="nowrap">Do:</th>
<td>vtigercrm-developers@lists.vtigercrm.com</td>
</tr>
<tr>
<th align="right" valign="baseline" nowrap="nowrap">Odpowiedź do:</th>
<td>vtigercrm-developers@lists.vtigercrm.com</td>
</tr>
</tbody>
</table>
<p> </p>
<!-- node type 8 --><!-- node type 8 --><!-- node type 8 -->
<div class="pre" style="margin: 0; padding: 0; font-family: monospace;">I need to have an EventHandler which fires when a module has a record either added or removed from it's related list in vtiger_crmentityrel.<br /><br /> Mod Tracker seems to be able to detect these events because the changes get written to the ModTracker tables and diplay in the Updates summary widgets etc...<br /><br /> However, having looked at the ModTracker Event Handler code, and registered a test handler I cannot get it to fire at all...<br /><br /> I've registered it with:<br /><br />
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">$em-⁠>registerHandler('vtiger.entity.aftersave.final', 'modules/⁠LSContracts/⁠resources/⁠LSContractsEventHandler.php', 'PeakDemandEventHandler');</blockquote>
<br /> And my test code is:<br /><br />
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;">class PeakDemandEventHandler extends VTEventHandler {<br /><br />     function handleEvent($eventName, $data) {<br />         global $log, $current_module, $adb, $current_user;<br />         require_once 'data/⁠VTEntityDelta.php';<br /><br />         $moduleName = $data-⁠>getModuleName();<br /><br />         $log-⁠>debug("In " . __CLASS__ . " " . __FUNCTION__);<br /><br />         if($eventName == 'vtiger.entity.aftersave.final') {<br />             $recordId = $data-⁠>getId();<br />             $columnFields = $data-⁠>getData();<br />             $vtEntityDelta = new VTEntityDelta();<br />             $delta = $vtEntityDelta-⁠>getEntityDelta($moduleName, $recordId, true);<br /><br />             $log-⁠>debug("EntityDelta: " . print_r($delta,true));<br />         }<br />     }<br /> }</blockquote>
<br /> this fires if I change a *field* in a module, but it doesn't trigger if I change a relationship in the crmentityrel table by either selecting or deleting a record from the Related List... How can I do this please?<br /><br /> Thanks<br /><br /> Al<br /><br /> _______________________________________________<br /><a href="http://www.vtiger.com/">http://www.vtiger.com/</a></div>
</body></html>