Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Adding fields to body of email?


This topic is 7827 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Obviously very new to FM!!

I have set up a script to send an email but in using the text body option I can't seem to merge any fields, like Dear <firstname>... is this possible or not an option? How can I do this?

Your help is much appreciated! :confused:

Posted

1 -create a global field with your mail text.

2 any "merge fields" should be enclosed by "<<" and ">>"

3 now make a calculation field

mailtext=substitute(substitute(g_mail_template,"<<firstname>>", firstname),"<<lastname>>",lastname) ....

of course, you could simply crate a calc

"Dear " & fistname & " " & lastname & " anytexthere..."

but that would require a trip to define fields every time you send a new mailing ....

instead of changing the global field, you could create a related FM file "templates.fp5" and simply select the appropriate template ...

  • Newbies
Posted

Thank you very much, cjaeger.

I have set up the first method. I have a challenge... step 3, I have this working:

Substitute(Substitute(mailtext, "<<firstname>>", First Name), "<<type>>", invitations::type)

how do I add more substituted merge fields? I can't seem to get the function written right. I want to add 2 more:

"<<area>>", invitations::area

"<<name>>", invitations::content_name

how do I put it together in one line?

Also, does this mean I have 2 fields on every record with all the text for the email? Will this make the dbase much bigger?

Again, many thanks.

Al

Posted

Hi,

If you want to add more fields to your substitution calc, then you would need to do the following

Substitute(Substitute(Substitute(Substitute(mailtext, "<<firstname>>", First Name), "<<type>>", invitations::type), "<<area>>, invitations::area),"<<name>>", invitations::content_name)

The basic idea is you first have the word substitute, then the field to substitute in and then what you want to substitute. So, when you concatenate in a single field multiple substitutes the substitute( goes first for [x] amount that you require, then the field to substitute in followed closely by what you want to substitute "what to substitute", [field to substitute with)

NOW, if anyone can follow this many substitutions AND not have a spelling mistake on them then :grin:

HTH

  • Newbies
Posted

Andy...

You are a superstar! "concatenate" - that was the word I was looking for!!

Thank you so much,

Alan

  • Newbies
Posted

IT WORKS!!!

Thanks to you both!

Al

p.s. Andy, it didn't work the first time with a copy and paste... but then with a little playing it did... is it right that the order has to be the order that they appear in the text?

  • 1 month later...
Posted

Alan, I am also trying to merge fields in the body text. Soo I type the text in the global field with, say, <<Name>>, and the result appears in the calc field, say, "mailtext". Does this mean that I need to identical template layouts for each mail (one to type the letter and the other to view/print/send the substitute fields)?

david

This topic is 7827 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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