Support Topics Documentation Slack YouTube Blog

Email form data

Hi there I have a form that users fill out to place an order. I can save the data in the backend no problem. I have email setup and tested. I have some logic setup to try and send the same form data to an email. I’m getting the email but no data can you explain the ‘send email from template’ logic block

Hello @tbc_guy

Could you please share code/logic how you send an email with data?

you can find doc for the EmailTemplates by the following link Send Emails with Templates API - Backendless REST API Documentation

Regards, Vlad

backendemail3

First pic is the template…not complete. Just testing with a few fields
Second Pic is the network traffic…nothing under template values. Everything else is correct
Third Pic is if I manually send from the template by filling in the variables i get that.
Last pic is the code block. I can find any into in documentation regarding “Send email from Template” block

Hello,

I think the problem is with the query connector. You are passing Form1 Data block in there, but it needs to be a text query that the server uses to identify the user accounts (in the Users table) that the email will go out to. If you want to send it to all users, do not attach anything to query, otherwise, compose a where clause to narrow down the user set.

Regards,
Mark

Mark, thanks for the reply. What it is I am trying to do is, users will access the app and fill out a form then that data will be emailed to the business for processing. No need for user accounts, all anonymous access right now. The owner doesn’t feel the need to generate a user database. I suggested it might a good idea, then he can push out weekly, monthly or random sales or when specials are on. He doesn’t understand it all so I’m being patient until he is more comfortable.

So one email it is going to. Every form submission will get email directly to the business email.

Dave

Hi Dave,

In this case, do not use the query connector. Instead, specify a list of email addresses the email should go out to using the addresses connector of the block.

Regards,
Mark

According to the template, I think you, have to create an object with property orders and then attach another object with firstname and lastname keys

Hi Vlad, i think i got it. I set up a playground page and got it working. This is the start and it sends the mail no problem. I’ll add this to the other page logic. I’m not sure if there is a shorter way of doing this. I will mark solved on approval of this method. Is there a way to clear the form after I am done. I can’t see a set field to “” block or similar

Hi @tbc_guy !

Your logic for sending the email looks good.
About form reset. Unfortunatelly there is only one way to reset form from code - explicitly set empty string to each field of form.

Regards, Andriy