argnom Posted February 27, 2008 Posted February 27, 2008 Hello, With a little help from you guys I was able to start a script to send personalized emails to our customers. I did some reading to be able to do most of what I wanted, but now I'm stuck and I need your help again. Here's the step script I have for now. I want it to send an email, personalized to each recipient (that's going well), insert the date and time when the message was sent (not elegant, but it "works" and to be able to "insert" the body of the message from another table (not going so well). Basically, I want to be able to write the body of the message in a new table under the field eng for English, fra for French etc..., select my script(email eng, email fra etc...) and voilà! The emails are sent. 1. Perform find test::mailing:[=yes] AND test::language: [=english] 2. Go to Record/Request/Page[first] 3. Loop 4. Insert Current Date [select; test::mail date] 5. Insert Current Time [select; test::mail time] 6. Go to Record/Request/Page [Next; Exit after last] 7. End Loop 8. Go to Record/Request/Page [First] 9. Loop 10. Send mail [no dialog; To: test::email, subject: "Hello World"; Message: "Hello " & test::salutations & " " & test::firstname & " " & test::lastname & "," & email::eng] 11. Go to Record/Request/Page [Next; Exit after last] [End Loop] The problem I am having right now is that is that when I start the script, I get an Err message stating that "the target is not part of a related table" and now, I am stuck. Thanks for the help.
_henry_ Posted February 27, 2008 Posted February 27, 2008 Hi, The problem I am having right now is that is that when I start the script, I get an Err message stating that "the target is not part of a related table" Have you write "Go to Layout [Your_Layout_Name]" on the top of your scripts? Usually, if you forgot to write this script and you "Perform Find" or "Set Field", it would show that error message. Hope it helps...
argnom Posted February 27, 2008 Author Posted February 27, 2008 Hello _henry_, Thank you for the pointer, the Err message is gone, but the text in the email::eng field does not appear. One problem down, one to go! I could always use a text file for the message but it's not as much "fun". :
_henry_ Posted February 27, 2008 Posted February 27, 2008 (edited) Hello argnom, Yeap, it would not show. So, you need to use "$Variable" to transfer the value from Email::Eng. So, it would be like this: Go to Layout{"Email::Eng") Set Variable ($EmailEng; Value:Email::Eng) Edit: I forgot to mention this... And, you need to change it in your "Send MaiL" From: Send mail [no dialog; To: test::email, subject: "Hello World"; Message: "Hello " & test::salutations & " " & test::firstname & " " & test::lastname & "," & email::eng] To: Send mail [no dialog; To: test::email, subject: "Hello World"; Message: "Hello " & test::salutations & " " & test::firstname & " " & test::lastname & "," & $EmailEng] Edited February 27, 2008 by Guest
argnom Posted February 28, 2008 Author Posted February 28, 2008 (edited) Hello _henry_, I'm sorry for the delay in replying to your post. It has been kinda busy at work... I have tried what you mentionned although it did not work, the pointer you gave me did help a lot to get it to work. Here's the working script. 1. Go to layout ["email" (email)] 2. Set variable [$emaileng; Value:email::eng] 3. Go to layout ["Data Entry" (test)] 4. Perform find test::mailing:[=yes] AND test::language: [=english] 5. Go to Record/Request/Page[first ] 6. Loop 7. Insert Current Date [select; test::mail date] 8. Insert Current Time [select; test::mail time] 9. Go to Record/Request/Page [Next; Exit after last] 10. End Loop. 11. Go to Record/Request/Page [First] 12. Loop 13. Send mail [no dialog; To: test::email, subject: "Hello World"; Message: "Hello " & test::salutations & " " & test::firstname & " " & test::lastname & "," & "¶ ¶" & $emaileng] 14. Go to Record/Request/Page [Next; Exit after last] 15. [End Loop] Thank you for the help _henry_. : Edited February 28, 2008 by Guest Fixed the numbering
_henry_ Posted February 28, 2008 Posted February 28, 2008 (edited) Hi Argnom, 1. Go to layout ["email" (email)] 2. Set variable [$emaileng; Value:email::eng] 3. Go to layout ["Data Entry" (test)] 1. Perform find test::mailing:[=yes] AND test::language: [=english] 2. Go to Record/Request/Page[first ] 3. Loop 4. Insert Current Date [select; test::mail date] 5. Insert Current Time [select; test::mail time] 6. Go to Record/Request/Page [Next; Exit after last] 7. End Loop 8. Go to Record/Request/Page [First] 9. Loop 10. Send mail [no dialog; To: test::email, subject: "Hello World"; Message: "Hello " & test::salutations & " " & test::firstname & " " & test::lastname & "," & "¶ ¶" & $emaileng] 11. Go to Record/Request/Page [Next; Exit after last] 12. [End Loop] I saw different scripts "numbering." Like "1,2,3,4,1,2,...,12" Are you making this in 2 different scripts? Usually, if I want to make 2 different scripts, I would make Global variable (using $$EmailEng as example). So, I can use the Global value in any different scripts that I want. If you are using Global variable, don't forget to clean it up after using it (by setting it to "" value). However, there is a trick using transferring value over local variable to another script, mentioned by Comment (if I am not mistaken). So, for now, let's try using $$ (global variables) and let me know if it works :-) Edit: Why don't you make it a relationship from Email database to Test database with Foreign key. So, you do not have to set variable. Because you also need to loop the $local_variable unless, you are using only a single email address for whole "Test" database. Edited February 28, 2008 by Guest
argnom Posted February 28, 2008 Author Posted February 28, 2008 Sorry aboot the numbering... my bad. It's all in one script. Copy/paste laziness/in a hurry error... Even though I did not loop the $local_variable, the script works fine for now. I do want it to do more (check the creation date in my email table to select the most recent message to send for example), but that will have to wait untill I receive the book I ordered. I'll RTFM, look at the examples and then I'll bother you guys for answers if I need them. : I really like this forum. Since my questions up untill now relate to the basic fuctions of this program, I was really surprised that nobody bluntly told me to simply RTFM. That would be the case in other places, but not here! You guys rock! Thank you again for the information and pointers. I'll try not to abuse of the cornucopia of information contained within your collective brains untill I receive the book. No promises though. That will teach you to be so helpfull Cheers!
_henry_ Posted February 28, 2008 Posted February 28, 2008 Then, I wish you good luck in your reading :=) Don't be shy to ask questions in this Forum. There are many Guru or FM experts that can help you out -) Cheers too :)
Recommended Posts
This topic is 6114 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 accountSign in
Already have an account? Sign in here.
Sign In Now