May 21, 20169 yr 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!
May 22, 20169 yr Author 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).
May 22, 20169 yr 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
May 22, 20169 yr Author 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, 20169 yr by charisse
May 22, 20169 yr On a looping script I think you always get a 101 after the loop exits after last record.
May 22, 20169 yr 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.
May 22, 20169 yr Author 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.
Create an account or sign in to comment