Email Image attachment not working

Hello Appsheet community,

I have a problem sending emails with one or more image attachments.
The email is always sent but without the attachments that I would like to deliver.

The data source of the App is a Google Sheet.
The email sending is executed by a bot, which is triggered when a new entry in the sheet “BAU_RECORDS” is added.
However, the path to the attachment(s) is stored in a sheet named “BAU_ATTACHMENTS”. The link/join between these two sheets is a ref column in the sheet “BAU_ATTACHMENTS”. If there are multiple attachments for one row in the sheet “BAU_RECORDS”, that many rows are added in the sheet “BAU_ATTACHMENTS” with the same REC_ID from the sheet “BAU_RECORDS”.

I know that you can change the default app folder in the info tab:

I tried already all kinds of combinations for the default app folder and the expression in the Other Attachments tab of the bot.
grafik

Nothing worked with an expression, I only managed to make it work with plain text of a file name of an image and the appropriate default app folder. Unfortunately this is not sufficient, as I always want to send the new images of the entries and not a static image.

Here are some examples of the expressions I tried in the Other Attachments tab of the bot:

When changing the result of the folder path I always changed the default app folder in a way that it should work.

Any help would be appreciated!
Regards,
Linus

This input is about your expression for Other attachments. Your first expression in general looks good to select images from the child table. The expression with SELECT() statement.

Have you seen how it looks in the test results pane? For example on a test app, I could see the associated images being selected for that particular parent record. Those particular images also appeared in the email also as attachments.

Display Images is the child table as below . MyImage ID is the referenced ID of the parent table

1 Like

In the results pane it looks like this:

In comparison to your entries in the Image column, in my app there are no indices/numbers reflecting the ID in the image file names (the parts you marked orange).

This is how the the column settings for ATT_PHOTO are:

Actually, your setup seems to be identical and good. You do have those indices you mention. Those are nothing but key of the record. I have highlighted it below in your records as well. In the record, you will find those collective indices in a column called something like [Related BAU_ATTACHMENTS]

Even in the latest image shared by you the photo files seem to have properly got selected.
You may wish to test BOT once without the default app folder ( making the entry in that setting blank) , I mean without the main attachment. This will ensure your image attachments (other attachments) are running well.

You may otherwise wish to see where the BOT is failing.

1 Like

If I try to make the entry blank for the default app folder and save the app, it sets the default app folder again.

Monitoring the bot did not help me yet, as the bot status is “Complete” most of the time without showing any errors. The errors in the screenshot happened when I changed some expression.

Is it possible that new rows for different tables are not added synchronously?
For example, the BOT is triggered when a new row in the table “BAU_RECORDS” is added. But when the BOT is running, the new row(s) in table “BAU_ATTACHMENTS”. storing the path to the images, are not existing yet?
In the Monitor section of the BOT, if I take a look at the inputs, some virtual columns depending on values of the “BAU_ATTACHMENTS” table are blank:

The column [REC_ATT_IMAGE] is a virtual column in table “BAU_RECORDS” with the following expression:
SELECT(BAU_ATTACHMENTS[ATT_PHOTO],([ATT_REC_ID] = [_THISROW].[REC_ID]))

If I test this expression in the results pane, it shows results, as already shown in previous screenshots:

I guess that might be the problem. When the BOT is running it tries to access rows in the “BAU_ATTACHMENTS” table, but those rows are not existing yet.

1 Like

Thank you for sharing these details. Yes, valid points and observation. That is a most likely a possibility. Please take a look at the following sample app and help articles

Topic: Why is the parent record displayed but the child records are missing?
Article:

Topic: “Sending Email Only After Adding a Parent Record and All of Its Children”

Article :

Sample App:
https://www.appsheet.com/samples/Send-an-email-when-children-are-added?appGuidString=75e6fdb0-7d89-4668-a971-0d09d8c15fd1

2 Likes

I managed to make it work thanks to the description of the sample App you shared.

Thank you so much for your help! :slight_smile:

2 Likes

You are welcome. Good to know it works as per your requirements.

I must say that the inputs you shared were methodical and your own analysis was also good.

All the best with your apps creation.

1 Like