Workflow rule or script to email sites with safety stock when product status changes

SOLVED

Good afternoon!

I am looking to set up a new workflow rule which will automatically email all of the affected product-sites when a product status is changed. 

So far, I have managed to set up a rule that will detect when the custom status field we have is changed from "OK" to "DS". It detects modification in the ITM event code, and looks like this:

At the end of the transaction, if the status is either of those codes, DM or DS, it will trigger a mail and works as expected.

However, we have over 300,000 products and 20 product sites, and not all product sites have all products. So what I'd like to have in the the recipient tab, is for more conditions to be set where, if a product site of the product that was modified has a safety stock that is "greater than 0", a mail will be triggered and sent to the affected site. Here's an example of how that should look, based on this logic:

However, the problem is that the product-site (event code ITF) is not related to the product (event code ITM). In my test email without those conditions, I put those calls in the message box to see if they would output. [F:ITF]STOFCY was returned blank and [F:ITF]SAFSTO was returned as 0. So it would seem that there is no communication between ITM and ITF in this context.

I am wondering if it is possible to set something like this up by other means, such as triggering an action/script that will perform where/if clauses to check the edited product in question from from the workflow. Like taking [F:ITM]ITMREF and injecting it into an if statement such that it can be called into ITF from ITM, and checked in ITF for the safety stock value to trigger emails from there, etc, if that makes sense.

Or maybe this is entirely possible from a workflow standpoint.

Any help is appreciated :)

Zoey