• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Email element?

Hi there,

I am currently running the email plugin to email someone if the element is set to Yes. And it works great with the following condition:

return '{rma_sheet___parts_received}'=='Yes';

My issue:

Everytime I update my form an email gets generated, how can I have it to only emailed if that element was 'Changed' to Yes?

Here is my current setup (Attached)..

Thank you so much!
 

Attachments

  • ss-email.png
    ss-email.png
    25.8 KB · Views: 316
I can't seem to make it work..... Even though this shows me how to get original data, it doesn't show me how create a condition to only email 'on change' or change from value No to Value Yes.... if a form element has a value of yes and is a value of yes after save, i don't want it to email.

Your reply is much appreciated troester!
 
Something like
$e_orig = ...;
$e_new =...;
return (e_orig == 'no') && ($e_new == 'yes');
 
How would that condition include the actual element name? If my element name is {rma_sheet___parts_received} and only want it to email if original data is 'No' and new data is 'Yes'

I know, I'm a pain the ass.. but you have no idea how much I appreciate the help!!!!
 
Friendly bump.

I tried my best to make this work with no success :( Seems so simple but can't get my hands on it. An exact condition code to try would be appreciated greatly!

How would I incorporate this below code with my specific element {rma_sheet___parts_received}...?

$e_orig = ...;
$e_new =...;
return (e_orig == 'no') && ($e_new == 'yes');
 
PHP:
$originalData = $formModel->getOrigData();
$e_orig = $originalData['rma_sheet___parts_received'];
$e_new =  '{rma_sheet___parts_received}';
return $e_orig != $e_new;

I can't recall 100% how $origData is formatted. It may be an array of arrays, so you'd need $originalData[0]['rma_sheet___parts_received'], and it may also be only "raw" data, so if (say) this is a checkbox, with value = 1 for a label of "No", the orig data may be 0, not No,

So, if that doesn't work, do this:

PHP:
var_dump($e_new, $orignalData);exit;

... as the line immidiately before the 'return'. This should echo out a bunch of debug data to your page, showing you exactly how your submitted value ($e_new) and the original data are formatted. Copy and paste that output here, if it's not obvious what you need to do.

-- hugh
 
Hi Cheesgrits....

Using the first code you added did the same as before... sent an email on every save :( Adding var_dump displayed the following on 'save': string(2) "No" NULL or string(2) "Yes" NULL
Yes or No depending what was selected.. so it returned the value on save.

I appreciate your help, I'm gonna keep trying what you suggested and see if any other adjustments will make it work.

Thank you!




 
Still nothing.. its crazy because on my email template I am able to pull original data and new data by using this code:

PHP:
<?php
    $origData = $formModel->getOrigData();
echo $origData[0]->rma_sheet___parts_received . ' has been updated to ' . $this->data['rma_sheet___parts_received'];
?>

The above code outputs like this: no has been updated to Yes
And for something as simple as to create a condition to email only if the element changed from "no to yes"doesn't seem to be possible...:(
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top