Trying to Automate Emails

Hi Ron,

In your solution, my understanding is that you want the email string to be populated in a textbox so it can be reviewed or modified before the email is sent.

You can still achieve this using a form with a Data View page. I would suggest the following approach:

  1. Make sure your General form has the field ‘Page Navigation’ set to ‘Top’ (not ‘Continuous’).

  2. Save the email string into a Five variable, and ensure this variable is available on the Data View page.

  3. On the General page record, add a function (for example, GetEmailOnSelecting) and attach it to the On Selecting event. This event will be triggered every time you navigate to the General tab.
    3.1. The function will populate the textbox with the email string.

If you want to allow changes to the email string, I recommend the following enhancement:

  • Add a new button to the General page, for example, Refresh Email List. This button should only be displayed when the textbox is empty.

    • The reason for this is that when you click the Edit button, any values populated by the GetEmailOnSelecting function are cleared, since the form is now in edit mode and the field is being manipulated manually.
  • Attach the same GetEmailOnSelecting function to the On Click event of this new button.

With this setup:

  • When you navigate to the General tab, the textbox is automatically populated.

  • If you click Edit and start modifying the field, the textbox will be cleared.

  • The Refresh Email List button then becomes visible, allowing you to repopulate the textbox with the original email string stored in the Five variable—this time in edit mode.

This creates a clean and flexible workflow, giving you the choice to either edit the email list or reuse the generated one.

I’ve also put together a quick sample app that demonstrates a similar UI behaviour (although it doesn’t generate an actual email). In the tab list, clicking a button generates an email and stores it in a Five variable. When you switch to the General tab, this email appears in the Email field. Once you edit the form, a new button appears to regenerate the email content. Clicking Send Email then displays the contents of the Email field, which could be passed to a server function to send the email.

I hope this helps.

If you prefer a different approach, you can use a dummy table to store the list of email strings. The email content can be generated in the Data View and saved to this dummy email table. By opening the corresponding form, you can then review and modify the email field before executing the mail merge.

This approach is more straightforward, though it requires the use of separate menus.

Regards,
Elton S

FilterCustomer-Trying to Automate Emails_Forum_610.fdf (3.4 MB)