It's useful to make sure that emails generated by a form go to an appropriate test account during the testing phase of building a form, and go to the correct recipient(s) once the form is in production.
This method is best suited for when you have a test email address that won't change. With this method, the test and production email addresses are hard-coded, so updating the email recipients requires editing the Conditional Logic.
For an alternative method that allows the form submitter to enter their email address for testing, see the page Set Email Recipients by Environment Using Emails Chosen by Form Submitter.
In this article:
- Creating a Logic to Determine Current Environment (Test or Production)
- Creating a Logic to Switch Emails Based on Environment
- Adding the Logic to your Email Template
Creating a Logic to Determine Current Environment (Test or Production)
- Under the Logic tab, add a new Logic to the form.
- Choose the Type Predefined.
- Select UMN - Jadu - Current Environment from the Formula drop down list.
- Give the logic a user-friendly name (ex: "Current Env") and select the Save button.
Creating a Logic to Switch Emails Based on Environment
- Add another Logic to the form.
- Choose the Type Conditional.
- Build out the conditional formula with these settings:
- In the If statement box, select the Predefined Logic you created above in the first step
- In the Return statement box, type the email address(s) that should receive the email when this form is being submitted in the Production environment.
- In the Else Return statement, type the email address(s) that should receive the email when this form is being tested in the Form Building environment.
Note: Multiple email addresses should be comma-separated, e.g., [email protected], [email protected]
- Give the logic a user-friendly name and select the Save button.
Adding the Logic to Your Email Template
To use the logics created above to switch the recipients of an email template based on the environment, follow the steps below.
- Open your existing action email template or create a new one.
- Click the # Variable button next to the To field in the email template.
- In the Insert Variable pop up window, click on the Logic tab and then click Insert next to the Conditional Logic that you created above.
- You should now see your Conditional Logic inserted as a variable in the To field of the email template.
- Complete the rest of your email template as required and then click the Save button.
Your email template is now ready to be used in a rule. Now every time the email template is triggered by a rule, Jadu will first check to see what environment the form is in and then send the email to the correct recipient(s)