Create file as email attachment

Hi, I am trying to create a file at the time of an error and attach it to an email notification. I’ve reviewed the documentation page but the example is about a smaller portion of data that needs to be decoded.

I’d like to get the contents of my data containers at the time of the user’s error to help me figure out what was happening when they experienced the error. Just dropping the objects into the content of the file doesn’t seem to work though. Can you advise the best way to package up this info?

Thanks!

Try separating the logic to understand which part fails. Check if Create File works. Once it does, work on the Send Email block - start with a static file path to see how it processes the attachments. Once that works, connect the two blocks together.

Good call Mark. I had just been doing that myself. The file converted to text worked fine. It turned out to be the attempt to convert today’s data to a UTC string. It contained invalid characters.

I need a unique file name that can be associated (most likely via time) with the event. I’ve tried a bunch of different variations of date to string, and just tried generating a UUID and then appending .txt to it. I can’t quite find a combo that will give a unique file name though.

Thoughts on a quick way to trim the date down to something acceptable?

How about something like this:
UI Builder - support - ConsoleDemo - Backendless 2024-06-07 18-30-14

and if you want to replace all space characters with dashes, do this:
UI Builder - support - ConsoleDemo - Backendless 2024-06-07 18-30-44

Awesome, thank you!

Thanks Mark, it took me a while to work my way back to this.

Had to debug a bit further until I caught all my bugs but I ended up making a couple custom functions to prepare a URL for attachment and log the data containers to a file. I thought I’d share for community reference in case anyone needs them.