<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(68,68,68)">How about running a Workflow with Custom Function?.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(68,68,68)">

<br></div><div class="gmail_default" style><font color="#444444" face="tahoma, sans-serif"><a href="https://wiki.vtiger.com/index.php/Invoke_Custom_Function">https://wiki.vtiger.com/index.php/Invoke_Custom_Function</a></font><br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 14 July 2014 14:37, SIAM Translations <span dir="ltr"><<a href="mailto:info@siam-translations.com" target="_blank">info@siam-translations.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Got impression that extension store will be interesting place to surf :-)<div><br></div><div>Andrew</div>

<div class="gmail_extra"><div><div dir="ltr"><div><br></div></div></div>
<br><br><div class="gmail_quote"><div><div class="h5">On Mon, Jul 14, 2014 at 3:47 PM, Holbok István <span dir="ltr"><<a href="mailto:holbok@gmail.com" target="_blank">holbok@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 class="h5">



  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Dear Vtiger Team,<br>
    <br>
    I am in the vtiger custom module development and there is an
    interesting question:<br>
    <br>
    This Custom module is related to the (standard) Contacts module and
    when some fields were changed in the Contacts module record,
    accordingly some change should be done in the related Custom module
    record.<br>
    <br>
    It is easy to manage with the following:<br>
    (1) Register an Eventhandler for the Contacts module (note: there is
    not any event registered for the Contacts module in the standard
    install of vtiger 6.1. SVN 14164)<br>
    <br>
    Vtiger_Event::register(<br>
         'Contacts','vtiger.entity.aftersave',<br>
         'ContactsHandler','modules/Contacts/ContactsHandler.php'<br>
    );<br>
    Vtiger_Event::register(<br>
        'Contacts','vtiger.entity.beforesave',<br>
        'ContactsHandler','modules/Contacts/ContactsHandler.php'<br>
    );<br>
    <br>
    This action can be done during postinstall action of the Custom
    module.<br>
    <br>
    And<br>
    (2) Append the already existing
    'modules/Contacts/ContactsHandler.php' file with the following
    class:<br>
    class ContactsHandler extends VTEventHandler {<br>
         function handleEvent($eventName, $data) {<br>
                 if($eventName == 'vtiger.entity.beforesave') {<br>
                         // Entity is about to be saved, take required
    action<br>
                 }<br>
                 if($eventName == 'vtiger.entity.aftersave') {<br>
                         // Entity has been saved, take next action<br>
                 }<br>
         }<br>
    } <br>
    <br>
    This will work without any doubt but in this way I have to modify a
    core file: 'modules/Contacts/ContactsHandler.php' and it could make
    some troubles for the Estension Store Custom module.<br>
    <br>
    <b>The Question is:</b> To avoid modifying core files, will it work,
    if I will put the custom Contacts handler into Custom module
    directory?<br>
    <br>
    The step 1, registering the eventhandler file in an other place: <br>
    Vtiger_Event::register(<br>
         'Contacts','vtiger.entity.aftersave',<br>
         'Contacts<b><font color="#cc0000">Custommodule</font></b>Handler','modules/<b><font color="#cc0000">Custommodule</font></b>/Contacts<font color="#cc0000"><b>Custommodule</b></font>Handler.php'<br>





    );<br>
    Vtiger_Event::register(<br>
        'Contacts','vtiger.entity.beforesave',<br>
        'Contacts<b><font color="#cc0000">Custommodule</font></b>Handler','modules/<font color="#cc0000"><b>Custommodule</b></font>/Contacts<font color="#cc0000"><b>Custommodule</b></font>Handler.php'<br>





    );<br>
    <br>
    The step 2, create a handler file in the Custommodule directory:<br>
    <br>
    modules/<font color="#cc0000"><b>Custommodule</b></font>/Contacts<font color="#cc0000"><b>Custommodule</b></font>Handler.php<br>
    <?php class Contacts<b><font color="#cc0000">Custommodule</font></b>Handler
    extends VTEventHandler {<br>
         function handleEvent($eventName, $data) {<br>
                 if($eventName == 'vtiger.entity.beforesave') {<br>
                         // Entity is about to be saved, take required
    action<br>
                        <font color="#cc0000"> // Some code to handle
      Contacts related actions in the related module.</font><br>
                 }<br>
                 if($eventName == 'vtiger.entity.aftersave') {<br>
                         // Entity has been saved, take next action<br>
                       <font color="#cc0000"> // Some code to handle
      Contacts related actions in the related module.</font><br>
                 }<br>
         }<br>
    } <br>
    ?><br>
    <br>
    Summary: Can I register an event handler with any name in any place?<br>
    Will it triggered on a proper time?<br>
    <br>
    Kindest regards:<br>
    István<span><font color="#888888"><br>
    <br>
    <div>-- <br>
      üdvözlettel:<br>
      <br>
      <b>Holbok István</b><br>
      <br>
      <a href="tel:%2B3670-342-0900" value="+36703420900" target="_blank">+3670-342-0900</a><br>
      <b>e-mail:</b> <a href="mailto:holbok@gmail.com" target="_blank">holbok@gmail.com</a><br>
      <b>SkyPe:</b> holboki<br>
      <br>
    </div>
  </font></span></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><br clear="all"><div><br></div>-- <br>Muhammed Abdul Salim<br>
</div>