Moving Workflows to Logic Hooks

Thanks in advance for anyone that replies to this thread!

I came from a GitHub issue I had posted about here: https://github.com/salesagility/SuiteCRM/issues/9225

I was told the discussion for this would be better suited here on the forums. I want to stray away from working on my workflows and create logic hooks instead since my workflows are sending an extra email for some reason. Right now I have 4 fields within two modules (2 fields in each Accounts and Cases). One field in each module is for updates to the record the user is working on and the other fields are invisible and act as a link between the two modules.

My workflows are setup as such (screenshots on the GitHub post):
Case Email Workflows-
Case update: When an IT person makes a change to the Case Updates field, the workflow sends a Case Email to the Assigned To user of the Case (IT). It then modifies a custom Date Time field to the current date and time on the Account that the Case is associated with.
Acct change: This workflow runs when the Date Time field of the Account has any change and sends out the same Case Email but to the Assigned To user of the Account (Sales).

Acct Email Workflows-
Acct update: When an Sales person makes a change to a custom Important Updates field, the workflow sends an Acct Email to the Assigned To user of the Account (Sales). It then modifies a custom Date Time field to the current date and time on the Case that the Account is associated with.
Case change: This workflow runs when the Date Time field of the Case has any change and sends out the same Acct Email but to the Assigned To user of the Case (IT).

As far as Iā€™m concerned the workflows are setup in a way that is supposed to send two identical emails to two different users. Since there is an extra email being sent I want to create some Logic Hooks to mirror the workflows I had created to try and get it to only send two emails.

I have read through the documentation about Logic Hooks and also took a look at the sugar_developer_guide_6.5 to try and get some knowledge about Logic Hooks.
For my case, would I need to create 4 different Logic Hooks like I did with the workflows or could I get it done in 2 or 1?
I am also bit confused on where I need to place the new php docs that I will create with custom code and just how to get started with this.

If anyone could shed some light on this it would be greatly appreciated!

System Specs:
SuiteCRM Version used: 7.11.20
Browser name and version: Chrome
Environment name and version: Microsoft SQL Server, PHP 7.3.26
Operating System and version: Windows Server 2019 build 17763

Excuse me, I posted a reply here earlier, but it was meant for another thread, I put it here by mistake.

Will reply to this one soon, I promise :slight_smile:

So about the Logic Hooks, try following these steps and create a new after_save logic hook in Cases module.

You can have a single logic hook per module. Then it checks which kind of change is happening, and can do distinct actions if needed.