Done.<div><a href="http://wiki.vtiger.com/index.php/vtiger510:Eventing#isNew">http://wiki.vtiger.com/index.php/vtiger510:Eventing#isNew</a></div><div><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 1:35 PM, 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;"><div>I already made changes to my code. Now i have to change it again. :)</div><div><br></div><div>Thanks Prasad. </div>
<div><br></div><div>This should be documented in Eventing wiki.</div><div><br></div><div>Regards,<br clear="all">

Darjan Prtic<br>
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Jan 7, 2011 at 08:18, Prasad <span dir="ltr">&lt;<a href="mailto:prasad@vtiger.com" target="_blank">prasad@vtiger.com</a>&gt;</span> wrote:<br></div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">

Darjan,<div><br>The event handler parameter will have the information<br>about the record mode as depicted below:<br><div><font face="&#39;courier new&#39;, monospace"><br></font></div>
<div><font 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 face="&#39;courier new&#39;, monospace">}</font></div><br>Regards,<br>Prasad<br>vtiger Team<br>
<div><font face="&#39;courier new&#39;, monospace"><br></font><div class="gmail_quote"><div><div></div><div>On Fri, Jan 7, 2011 at 11:45 AM, Darjan Prtic <span dir="ltr">&lt;<a href="mailto:dprtic@gmail.com" target="_blank">dprtic@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>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></div></div>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div></div>
<br></div></div>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>