<div dir="ltr">For those interested, to fire an event when an entity is unlinked from its parent, add the following to include/utils/utils.php at line 1394:<div><br></div><div><div>require_once("include/events/include.inc");</div>
<div>$adb = PearDatabase::getInstance();</div><div>$em = new VTEventsManager($adb);</div><div>$em->initTriggerCache();</div><div>$entityData = VTEntityData::fromEntityId($adb, $record);</div><div>$em->triggerEvent("vtiger.entity.beforeunlink", $entityData);</div>
</div><div><br></div><div>and then for an event fired after unlink, after this line just under what you inserted at 1394:</div><div><br></div><div>$focus->trackUnLinkedInfo($return_module, $return_id, $module, $record);</div>
<div><br></div><div>add the following:</div><div><br></div><div>$em->triggerEvent("vtiger.entity.beforeunlink", $entityData);<br></div><div><br></div><div>Cheers</div><div><br></div><div>Max</div><div><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 25, 2014 at 11:02 AM, Max Clarke <span dir="ltr"><<a href="mailto:max@smarte.com.au" target="_blank">max@smarte.com.au</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">Just a little more on this, after the event not firing and me tracing around the vtiger source... <div><br>
</div><div>I realised that when you delete an entity from a related list it merely unlinks it, not deletes it.</div>
<div><br></div><div>This might be intended behaviour, but from an end user standpoint, doesn't make much sense. Usually when you click a trash can icon and it pops up and prompts you "Are you sure you want to delete?", you think the entity will be deleted, not unlinked. Perhaps you need 2 buttons instead of 1 - one to delete which will be actually delete the object, and one to remove it from it's parent (unlink).</div>

<div><br></div><div>Anyway, unfortunately there's no event that fires on this unlink method, so if anyone has any ideas besides modifying the core source to fire an event, I'm all ears!</div></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Mar 25, 2014 at 9:08 AM, Max Clarke <span dir="ltr"><<a href="mailto:max@smarte.com.au" target="_blank">max@smarte.com.au</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">Unfortunately those aren't in the vtlib manual or on the Eventing Vtiger page: <a href="https://wiki.vtiger.com/index.php/Eventing" target="_blank">https://wiki.vtiger.com/index.php/Eventing</a><div><br>

</div><div>Thanks for the tip though, that'll do the trick!</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Mon, Mar 24, 2014 at 5:10 PM, Joe Bordes <span dir="ltr"><<a href="mailto:joe@tsolucio.com" target="_blank">joe@tsolucio.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 text="#000000" bgcolor="#FFFFFF">
    <div>Not a workflow but you have two events
      to create eventhandlers:<br>
      <br>
      beforedelete<br>
      afterdelete<br>
      <br>
      you can read on how to create eventhandlers in the vtlib manual<br>
      <br>
      Joe<br>
      TSolucio<br>
      <br>
      <br>
      El 24/03/14 04:22, Max Clarke escribió:<br>
    </div>
    <blockquote type="cite"><div><div>
      <div dir="ltr">Hi guys,
        <div><br>
        </div>
        <div>Hopefully an easy one. Is there a way to execute a workflow
          when an entity is deleted?</div>
        <div><br>
        </div>
        <div>The reason I ask is so I can update a field in Tickets when
          a custom submodule entity is deleted.</div>
        <div><br>
        </div>
        <div>Cheers</div>
        <div><br>
        </div>
        <div>Max</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a></pre>
    </blockquote>
    <br>
  </div>

<br></div></div>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>