<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">On Fri, Jan 7, 2011 at 08:18, Prasad <span dir="ltr"><<a href="mailto:prasad@vtiger.com">prasad@vtiger.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Darjan,<div><br>The event handler parameter will have the information<br>about the record mode as depicted below:<br><div><font face="'courier new', monospace"><br></font></div>
<div><font face="'courier new', monospace">class MyModuleEventHandler extends VTEventHandler { <br> function handleEvent($eventName, $data) { <br> if ($data->isNew()) {<br> // Create of new record<br>
} else {<br> // Edit of older record<br> }<br> }</font></div><div><font face="'courier new', monospace">}</font></div><br>Regards,<br>Prasad<br>vtiger Team<br>
<div><font face="'courier new', monospace"><br></font><div class="gmail_quote"><div><div></div><div class="h5">On Fri, Jan 7, 2011 at 11:45 AM, Darjan Prtic <span dir="ltr"><<a href="mailto:dprtic@gmail.com" target="_blank">dprtic@gmail.com</a>></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">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>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>