charisse Posted May 21, 2016 Posted May 21, 2016 I have written two scripts to email invoices to customers. The first time I run the script everything works fine, but if I need to run the script again the emails are created, but only the final email has a pdf attached. If I close both of the databases involved the script runs properly again (one time). Any ideas? Thanks!
Steve Martino Posted May 22, 2016 Posted May 22, 2016 Did you watch it in the script debugger to see where/when it fails?
charisse Posted May 22, 2016 Author Posted May 22, 2016 Yes, the script runs (very quickly BTW) and shows no errors, but there are no pdfs attached to the emails generated (except for the last email which has the pdf for the last record attached).
Steve Martino Posted May 22, 2016 Posted May 22, 2016 I don't understand this part: 12 hours ago, charisse said: the script runs (very quickly BTW) and shows no errors If you're in the script debugger, stepping thru one script step at a time, you see each step unfold, and any errors after each step. I would make sure you have the toolbars showing (so you can see record count, total records, etc. to see if the everything is the same the first time you run the script as it is on the second time-record counts, pdf's generated, etc.. Also after the Save Records as PDF step, are the proper number of pdf's generated for each customer? You could post a sample file, although it appears you are using at least 2 files in your solution
charisse Posted May 22, 2016 Author Posted May 22, 2016 (edited) The first time I run the script it seems to take the time to create the pdfs/invoices. The second time I run the script in completes in a fraction of the time generating email with no pdf. I am not too familiar with the debugger. I think I have the toolbars showing, but I am not sure how to see the record count, total records, pdfs generated etc. I stepped through the script and as I did so, the pdfs (should be one per email) were created on the emails. I am thinking that the script is running too fast to generate the pdf the second time around? I put in a 1 second pause after the Send Mail step and that seems to have "fixed" the issue, but I am left with a curious error message in the debugger. 101 record cannot be found? I don't know what to make of that. Edited May 22, 2016 by charisse
Steve Martino Posted May 22, 2016 Posted May 22, 2016 On a looping script I think you always get a 101 after the loop exits after last record.
doughemi Posted May 22, 2016 Posted May 22, 2016 The 101 error occurs because of the exit after last step in your first script (the fact that FM couldn't find another record triggers the exit after last). You can eliminate it by adding Exit Loop If[ Get(RecordNumber) = Get(FoundCount) ] just before the Go to Record/Request step.
charisse Posted May 22, 2016 Author Posted May 22, 2016 18 minutes ago, Steve Martino said: On a looping script I think you always get a 101 after the loop exits after last record. Good to know. 12 minutes ago, doughemi said: You can eliminate it by adding Exit Loop If[ Get(RecordNumber) = Get(FoundCount) ] just before the Go to Record/Request step. I will give that a try. Thank you both.
Recommended Posts
This topic is 3105 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