Community

How To Use Data From One Action In Another In Same Triggered Rule

I created a form (via the webform module) that is going to be used for website visitors to contact staff members. The url for the form includes a parameter with the staff members id# that is saved as a hidden field with the submission.

I then created a rule with 2 actions:

The first action (execute php code) retrieves the hidden field with the staff members id# and performs a database query to retrieve their email address. Result of query is $email.

The second action (send html email) is used to send an email to the staff member the submission was meant for.

The problem: I want to use the result of the database query in action 1 to dynamically fill the recipient field in action 2. I can't find the proper formatting to call the result from action 1. I can insert the query into the body of the email in action 2 and it executes and then will display the result. I tried using

<?php
echo $email;
?>
in the recipient field and body area but they are always blank.

Is there a way to pass data from one action to another within the same rule?

Comments

Does this have to be done as

Does this have to be done as a rule set? Is so, will there not still be the issue of passing the data from one to the other?

nobody click here