<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarai.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/dev-club/f/questions-answers/8363/bizarre-logic-hook-problem</link><description>I was working on cleaning up some very very old code (I think v6 or v7) 
 As I do that I wanted to be more consistent with naming conventions 
 The original logic hook was 
 $ hook_array [ &amp;#39;process_record&amp;#39; ][] = Array ( 1 , &amp;#39;conditional_formatting&amp;#39; ,</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33784?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2026 21:45:18 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:6e50f655-a994-413c-b682-6a153322497a</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Yes, the original hook works fine.&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t think it&amp;#39;s worth your time trying to figure this out.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks for the note on the change in Logic Hooks, I&amp;#39;ll plan to move to Extensions with the next upgrade. It will be a bit of work given that&amp;nbsp;over 40&amp;nbsp;modules have logic hooks...&lt;/p&gt;
&lt;p&gt;Thanks again!&amp;nbsp;&lt;br /&gt;Francesca&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33783?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2026 15:59:55 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:3de3850e-9c28-4c05-aae5-38ae17ae2bc0</guid><dc:creator>Angel Magana</dc:creator><description>&lt;p&gt;Whether it shows or doesn&amp;#39;t will be dependent on how one goes about defining the hook.&lt;/p&gt;
&lt;p&gt;Older versions of Sugar would use the approach that leverages the logic_hooks.php file. At some point, we introduced Logic Hooks into the capabilities of the Extensions Framework, which then allowed one to define a logic hook by way of extensions and in turn, use the logichooks.ext.php file. Both approaches are equally valid, but we do favor the Extensions approach for situations where a customization can be implemented through multiple means.&lt;/p&gt;
&lt;p&gt;Your hooks are likely configured that way due to their age. There is nothing inherently wrong with them.&lt;/p&gt;
&lt;p&gt;As a side note, the order numbering is fine. That&amp;#39;s mostly relevant for scenarios where you have multiple hooks of the same type (e.g. before_save) and need them to execute in a specific order.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll ask a dumb question, does the hook work if you rename the files back to their prior name?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33782?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2026 15:45:57 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:d5643d38-0351-4137-992d-4642a1ce7d3d</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;I don&amp;#39;t, but should they? &lt;br /&gt;I don&amp;#39;t see any custom logic hooks in that file, not even for the hooks that work just fine.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This is all I see in&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;custom/modules/Cases/Ext/LogicHooks/logichooks.ext.php &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="php"&gt;&amp;lt;?php
// WARNING: The contents of this file are auto-generated.
?&amp;gt;
&amp;lt;?php
// Merged from modules/Cases/Ext/LogicHooks/RelationshipHook.php

/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */

$hook_array[&amp;#39;before_relationship_delete&amp;#39;][] = [
    1,
    &amp;#39;beforeRelationshipDelete&amp;#39;,
    &amp;#39;modules/Cases/CasesHooks.php&amp;#39;,
    &amp;#39;CasesHooks&amp;#39;,
    &amp;#39;beforeRelationshipDelete&amp;#39;,
];

$hook_array[&amp;#39;after_relationship_add&amp;#39;][] = [
    1,
    &amp;#39;afterRelationshipAdd&amp;#39;,
    &amp;#39;modules/Cases/CasesHooks.php&amp;#39;,
    &amp;#39;CasesHooks&amp;#39;,
    &amp;#39;afterRelationshipAdd&amp;#39;,
];

$hook_array[&amp;#39;after_relationship_delete&amp;#39;][] = [
    1,
    &amp;#39;afterRelationshipDelete&amp;#39;,
    &amp;#39;modules/Cases/CasesHooks.php&amp;#39;,
    &amp;#39;CasesHooks&amp;#39;,
    &amp;#39;afterRelationshipDelete&amp;#39;,
];

?&amp;gt;
&amp;lt;?php
// Merged from custom/Extension/modules/Cases/Ext/LogicHooks/denorm_field_hook.php

/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */

// Relate Field Denormalization hook

$hook_array[&amp;#39;before_save&amp;#39;][] = [
    1,
    &amp;#39;denorm_field_watcher&amp;#39;,
    null,
    &amp;#39;\\Sugarcrm\\Sugarcrm\\Denormalization\\Relate\\Hook&amp;#39;,
    &amp;#39;handleBeforeUpdate&amp;#39;,
];

$hook_array[&amp;#39;after_save&amp;#39;][] = [
    1,
    &amp;#39;denorm_field_watcher&amp;#39;,
    null,
    &amp;#39;\\Sugarcrm\\Sugarcrm\\Denormalization\\Relate\\Hook&amp;#39;,
    &amp;#39;handleAfterUpdate&amp;#39;,
];

$hook_array[&amp;#39;before_relationship_delete&amp;#39;][] = [
    1,
    &amp;#39;denorm_field_watcher&amp;#39;,
    null,
    &amp;#39;\\Sugarcrm\\Sugarcrm\\Denormalization\\Relate\\Hook&amp;#39;,
    &amp;#39;handleDeleteRelationship&amp;#39;,
];

$hook_array[&amp;#39;after_relationship_add&amp;#39;][] = [
    1,
    &amp;#39;denorm_field_watcher&amp;#39;,
    null,
    &amp;#39;\\Sugarcrm\\Sugarcrm\\Denormalization\\Relate\\Hook&amp;#39;,
    &amp;#39;handleAddRelationship&amp;#39;,
];

?&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And these are my working (tested) Logic hooks,&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;custom/modules/Cases/logic_hooks.php&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="php"&gt;&amp;lt;?php
/**
 * logic_hooks.php — Cases module
 *
 * Hook registration order within each event is determined by the first
 * element of each entry (the position integer). Lower numbers run first.
 *
 * Format: array(position, label, file, class, method)
 */

$hook_version = 1;
$hook_array   = array();

// -----------------------------------------------------------------------------
// before_save
// -----------------------------------------------------------------------------
$hook_array[&amp;#39;before_save&amp;#39;][] = array( 3, &amp;#39;beforeSave&amp;#39;,        &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                      &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;beforeSave&amp;#39;,);
$hook_array[&amp;#39;before_save&amp;#39;][] = array( 4, &amp;#39;updateLog&amp;#39;,         &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                      &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;updateLog&amp;#39;,);
$hook_array[&amp;#39;before_save&amp;#39;][] = array( 5, &amp;#39;checkEmailAddress&amp;#39;, &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                      &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;checkEmailAddress&amp;#39;,);
$hook_array[&amp;#39;before_save&amp;#39;][] = array( 6, &amp;#39;checkVIP&amp;#39;,          &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                      &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;checkVIP&amp;#39;,);
$hook_array[&amp;#39;before_save&amp;#39;][] = array( 7, &amp;#39;checkGDPR&amp;#39;,         &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                      &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;checkGDPR&amp;#39;,);

// -----------------------------------------------------------------------------
// after_save
// -----------------------------------------------------------------------------
$hook_array[&amp;#39;after_save&amp;#39;][] = array( 3, &amp;#39;afterSave&amp;#39;,               &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                 &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;afterSave&amp;#39;,);
$hook_array[&amp;#39;after_save&amp;#39;][] = array( 4, &amp;#39;saveContactRelationship&amp;#39;, &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,                 &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;saveContactRelationship&amp;#39;,);

// -----------------------------------------------------------------------------
// after_relationship_add
// -----------------------------------------------------------------------------
$hook_array[&amp;#39;after_relationship_add&amp;#39;][] = array( 1, &amp;#39;checkVIP&amp;#39;,          &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,           &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;checkVIP&amp;#39;,);
$hook_array[&amp;#39;after_relationship_add&amp;#39;][] = array( 2, &amp;#39;compProductNotes&amp;#39;,  &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,           &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;compProductNotes&amp;#39;,);

// -----------------------------------------------------------------------------
// after_relationship_delete
// -----------------------------------------------------------------------------
$hook_array[&amp;#39;after_relationship_delete&amp;#39;][] = array( 1, &amp;#39;checkVIP&amp;#39;,       &amp;#39;custom/modules/Cases/Cases_Logic.php&amp;#39;,           &amp;#39;AutomatedCaseHandling&amp;#39;, &amp;#39;checkVIP&amp;#39;,);

// -----------------------------------------------------------------------------
// process_record
// -----------------------------------------------------------------------------
$hook_array[&amp;#39;process_record&amp;#39;][] = Array(1,&amp;#39;conditional_formatting&amp;#39;,&amp;#39;custom/modules/Cases/conditional_formatting.php&amp;#39;,&amp;#39;ConditionalFormatting&amp;#39;,&amp;#39;conditional_formatting&amp;#39;);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Not all numbering starts with 1 because I removed some old hooks and didn&amp;#39;t think to renumber until now, but that has no created issues for years.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Francesca&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33781?ContentTypeID=1</link><pubDate>Mon, 06 Apr 2026 14:42:19 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:170cf34f-91c7-46a9-8297-01917c83687d</guid><dc:creator>Angel Magana</dc:creator><description>&lt;p&gt;Hi Francesca,&lt;/p&gt;
&lt;p&gt;Another thought that crosses my mind is that perhaps the QRR process didn&amp;#39;t pick up the definition.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you seeing a reference to the definition file in ./custom/modules/&amp;lt;Module&amp;gt;/Ext/LogicHooks/logichooks.ext.php ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33780?ContentTypeID=1</link><pubDate>Fri, 03 Apr 2026 00:18:03 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:4d059ac9-2a40-408d-9651-4c149566ad0e</guid><dc:creator>Francesca Shiekh</dc:creator><description>&lt;p&gt;Thank you Angel, I double checked everything, including copy/paste names in searches in the code to make absolutely sure they are the same...&lt;span class="emoticon" data-url="https://sugarclub.sugarai.com/cfs-file/__key/system/emoji/1f937.svg" title="Shrug"&gt;&amp;#x1f937;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bizarre logic hook problem</title><link>https://sugarclub.sugarai.com/thread/33779?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2026 22:08:14 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:62e30b89-0459-4b87-af7a-53320c786a58</guid><dc:creator>Angel Magana</dc:creator><description>&lt;p&gt;Hi Francesca,&lt;/p&gt;
&lt;p&gt;Yeah, something doesn&amp;#39;t add up. I would be equally puzzled as renaming things wouldn&amp;#39;t cause such problems, assuming everything lines up in the definition file, etc.&lt;/p&gt;
&lt;p&gt;Is it possible that the permissions on the files were changed when your renamed them? Other than that, the only other thing I can think of is the casing on the names...that is, the names might match, but the casing doesn&amp;#39;t.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>