Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SuperContainer as email attachment in scheduled server script

Featured Replies

Hello - 

 

I have been using SuperContainer for years and we use it to 'pipe' the SuperContainer URL as $attachmentpath to the Attachment section of the Filemaker Send Email Script step. This works perfectly when run on the client software. 

However, I cannot get it to run on a server side script, where I would like to send certain email attachments automatically at certain times of the day. 

 

I do have the SuperContainer companion installed on FMS18 on a Mac - is there any pearls of wisdom anybody could share? Has anybody done this? Thank you. 

 

 

Hi DataCruncher,

If you are using the native FileMaker Send Mail script step then for server-side scripts if you attach a file, that file needs to be in a folder that server-side scripts are allowed to access. Are you downloading the file using the companion plugin prior to attaching it to an email? If so, are you downloading it to a file path or to a container?

  • Author

Thank you Ryan. That is a really interesting approach, because on the client, I just use the URL that SuperContainer rests at. I figured server-side I would have to download, but was not quite sure how to tell when the download has finished. 

I did a SCDownload to the Temp folder - but the script still won't pick up on the email attachment. Could this be because the script has no way of telling when the Download has finished is is trying to look for a filename that does not (yet) exist, and if so, how do I navigate around that? Is there a 'wait for complete' option on SuperContainer or can I use some sort of WAIT directive? 

But since you asked about whether I download to a file path or container, do you think a container would be the better option? 

In my experience the only place that FMS most definitely has read/write permissions to is its own Documents folder. I suspect it doesn't have read permissions to the tmp location.

Downloading to a container will eliminate the need for correct permissions but means that file will reside in your database so you may want to clear the container as a part of the script if you do not want to store the file within the database. I don't think you will need to wait for the download to complete as script steps should execute chronologically and shouldn't execute until the previous step has completed. Please keep in mind that if you take the container approach, you will probably need to add context to your script like go to layout, go to record to ensure the field reference is referencing the intended container.

  • Author

Well, bummer. 

So I managed to download the file with the SCDownload function to my /Users/user/Downloads folder. 

Problem being - server side, that folder is 'invisible' to the server side scripting engine. 

 

When I followed the advice to try and download the document to the own Documents Folder at /Library/FileMaker\ Server/Data/Documents - guess what? The file doesn't save!

 

I have tried everything in my might. I made a tmp folder under the FMS Documents root. Set permissions to 777. Changed ownership. Nothing will get it to work. What on earth am I doing wrong? 

22 minutes ago, DataCruncher said:

When I followed the advice to try and download the document to the own Documents Folder at /Library/FileMaker\ Server/Data/Documents - guess what? The file doesn't save!

Are you capturing for errors on SCDownload? If so, are there any errors being set? 

  • Author

Well look at that: 

 

java.lang.IllegalStateException: Could not create directory: /Library/FileMaker\ Server/Data/Documents

 

But the directory already exists. Weirdness.  

Also, all permissions are set properly. I am wondering if I am not escaping the empty space in the path correctly? 

 

Solved the download part of it. 

The file is now stored in Documents/Filename. 

This path is then set as a variable: 

$path="file:Documents/Filename"

 

Only, when I add $path as attachment path to the send email server side script, nothing is attached? 

8 minutes ago, DataCruncher said:

I am wondering if I am not escaping the empty space in the path correctly? 

I don't think you need to. Try it without the escape character.

  • Author

That worked for the download part- the file now correctly downloads to the folder. However, when attaching to the attachment path, it still does not attach. I have no idea how to track the problem down here. 

The $path variable correctly comes through as:

 

filemac:/Library/Filemaker Server/Documents/TEST.docx

 

Only it does not attach.... This is on FMS18 on a Mac. 

If you are using the native Send Mail script step then I am not sure how to assist. You may need to post in a more general section of the forums so that the question is more visible to users not specifically looking in the 360Works specific section. That being said, since this is server side, you may can check the Event.log file for any errors being set during the Send Mail call. The documentation for the function here might be of help as well as this page on creating file paths.

  • Author

I just realized 360works has an email plugin. Do you think that could help me attach my files server-side? 

Yes it should be able to do that. You can try the plugin out for free in demo mode but you will need to restart the FMSE after two hours of it running or you will get demo mode errors. The plugin process is still going to run under the FMS user so you will probably have to deal with the same permissions so I would still download the file to the FileMaker Server Documents folder. However, if you have an issue with the email plugin picking up the attachment path, I would be able to take a look at the plugin logs to see why. 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.