<meta charset="utf-8">Darjan,<div><br>The event handler parameter will have the information<br>about the record mode as depicted below:<br><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">class MyModuleEventHandler extends VTEventHandler { <br>    function handleEvent($eventName, $data) { <br>        if ($data-&gt;isNew()) {<br>            // Create of new record<br>
        } else {<br>            // Edit of older record<br>        }<br>    }</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div><br>Regards,<br>Prasad<br>vtiger Team<br>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font><div class="gmail_quote">On Fri, Jan 7, 2011 at 11:45 AM, Darjan Prtic <span dir="ltr">&lt;<a href="mailto:dprtic@gmail.com">dprtic@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi!<div><br></div><div>Is there a way using event handlers to distinct when some record is being updated (edited and then saved) and newly added?</div>
<div>When new record is saved i make relations in vtiger_crmentityrel table by inserting corresponding crmid of that module and contact, also vice versa. I do that in aftersave event because i need crmid of record that is being created. That works fine. But now i have a problem when i just edit that record and save it. New, unnecessary insert is being made to vtiger_crmentityrel table with already existing values. What should be done is _only_ update if necessary.</div>


<div><br></div><div>I use vtiger 5.10.</div><div><br></div><div>Thank you!</div><div><div>Darjan Prtic<br>
</div></div>
<br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div></div>