Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Generating Estimate with a script...having trouble

Featured Replies

Hello All,

I'm just dipping my feet in scripts and I've trying this for a couple of days, but can't figure this out.

I want to generate a pdf of an Estimate.

I have a layout called Estimate Worksheet (based on the Estimate Table with portal based on EstimateLineItem).

After filling out the Estimate Worksheet, I then want to go to my Estimate Printable layout (based on my EstimateLineItem table) and consolidate all the related line items for a particular Estimate, sorted (according to ItemCategory), and the generate a pdf.

I can do this manually, but I want to automate this. But I can't seem to find a way to make it find all the related EstimateLineItems records for the estimate. I think it has to be with my inability to make it galvanize line items related to the EstimateID.

I am sure this is a common maneuver but I can't seem to get my head around this!!

Any direction would be greatly appreciated.

Save records as PDF[Restore; No dialog;"invoice.pdf";Records being browsed]

  • Author

Thank you FMP12 for your prompt response.

It worked, however, I would like it to print not the Estimate Worksheet layout in which I am, but in my "Estimate Printable" layout.

The Estimate Worksheet layout has a lot of objects not needed in the Estimate which will eventually go to the client.

The two layouts are based on different tables -- and I believe this is what is causing me grief.

If you can help me through this extra step, it would be greatly appreciated...

Thank you again.

  • Author

Beein trying this in baby steps.

This is what I've got so far:

Go to Layout ["Estimate Printable" (EstLineItem)]

Perform Find [Restore]

Sort Records [Restore; No dialog]

Save Records as PDF [Restore; No dialog; "EstimatePrint.pdf"; Automatically open; Create email; Records being browsed]

This does what I want, but I have to manually input the number of the Estimate when I am taken to the Estimate Printable.

(ok, here I scripted in EstimateID = 89, just to see if it would do it.)

But I can't figure out how to populate this field with the current EstimateID that I am working on in the Estimate Worksheet.

If I follow you..

I want to print /email estimate # 89

so your code is really correct, just set the estimate # as a variable and then using perform find to findit.


/* make a variable of the estimateID number */

$EID =estimateID

Go to Layout ["Estimate Printable" (EstLineItem)]

/* your perform find should be your estimateID field = $EID */

Perform Find [Restore]

Sort Records [Restore; No dialog]

Save Records as PDF [Restore; No dialog; "EstimatePrint.pdf"; Automatically open; Create email; Records being browsed]

…I have a layout called Estimate Worksheet (based on the Estimate Table with portal based on EstimateLineItem).…But I can't seem to find a way to make it find all the related EstimateLineItems records for the estimate….

… how to populate this field with the current EstimateID that I am working on in the Estimate Worksheet.



/* make a variable of the estimateID number */

$EID =estimateID

FMP12 -

you're aware there is a script step called Go to Related Record?

  • Author

Thank you all for your input.

Go to Related Record is what I tried initially, but for some reason it still gave me all the EstimateLineItems rather than just the related ones for the Estimate that I was working on. It might be something else that I was doing wrong.

FM12, I will try your suggestion when I return to work tomorrow. It sounds like something that I was looking for.

Looking forward to gaining confidence in scripting in the weeks ahead.

Thanks again all

Go to Related Record is what I tried initially, but for some reason it still gave me all the EstimateLineItems rather than just the related ones for the Estimate that I was working on. It might be something else that I was doing wrong. […] Looking forward to gaining confidence in scripting in the weeks ahead.

Then you might as well start doing it right ;)

When you use GTRR, make sure to check the Show only related records and Match current record only options. This should give you the related EstimateLineItems for the current Estimates record, no more, no less.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.