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

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

Recommended Posts

Posted

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!

Screen shot 2016-05-21 at 3.13.11 PM.png

Screen shot 2016-05-21 at 3.12.02 PM.png

Posted

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).

Posted

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

Posted (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.

Screen shot 2016-05-22 at 11.42.56 AM.png

Screen shot 2016-05-22 at 11.34.41 AM.png

Edited by charisse
Posted

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.

Posted
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.

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 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.