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.

Problem with Attachments and Variables

Featured Replies

  • Newbies

What I have been doing is, first I set a loop so that it grabs 1 field, the same field, which is the raw data URL from the container, and sets it up in the variable. This is the calculation:

Set Variable [$List ; List ( $List ; "EmailAttachFile( "&"\""&Documents::_c_RawData URL&"\""&" ) and" )]

It appears to get the data correctly, because I have it set a random field just to make sure. So I setRandomField $List, and it displays what I have gathered from the records:

EmailAttachFile( "http://url1" ) and

EmailAttachFile( "http://url2" ) and

EmailAttachFile( "http://url3" ) and

When I run the following script, it nothing happens however (I took out the email information for privacy):

EmailSetBody( "This is the body of the email" ; "plain" ) and

$List

EmailSend and

EmailDisconnect

BUT, when I run the following script, it works perfectly:

EmailSetBody( "This is the body of the email" ; "plain" ) and

EmailAttachFile( "http://url1" ) and

EmailAttachFile( "http://url2" ) and

EmailAttachFile( "http://url3" ) and

EmailSend and

EmailDisconnect

Any thoughts on why this is happening?

If you are assigning the variable $List to the result of the EmailAttachFile function calls the value in that variable will be 1 (provided there are no errors). If you are doing this before calling EmailConnect or EmailCreate it will not have any message to attach the files to and should return an error instead. In either case, the result of calling the EmailAttachFile functions is not the same thing as calling them. It appears this is why you are experiencing the difference in behavior.

  • Author
  • Newbies

Here is my full code, obviously with the real email information hidden for privacy purposes. This is the whole step, and is a calculation for $result variable:

EmailConnectSMTP(

"smtp.gmail.com:465" ;

"[email protected]" ;

"hidden" ;

"ssl=1") and

EmailCreate ( "[email protected]" ; "[email protected]" ; "Hidden" ) and

EmailSetBody( "This is the body of the email" ; "plain" ) and

$List

EmailSend and

EmailDisconnect

  • Author
  • Newbies

In either case, the result of calling the EmailAttachFile functions is not the same thing as calling them. It appears this is why you are experiencing the difference in behavior.

I think I understand what you mean by this, meaning that it's bringing it in as text rather than the function. Do you know how I can solve this?

You can't really "solve" this as the function will be executed wherever it is being called. In your case, that looks to be in after the EmailSetBody call. You should still be able to create a script that has logic to accomplish what you need.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.