6 Replies Latest reply on May 13, 2013 8:33 AM by philmodjunk






           following works correct when one record  found -  when more, only saves pdf and sends email for first record found?

           •Set Error Capture [ On ]
           •Go to Layout [ “WorkOrder” (WorkOrder) ]
           •Show All Records
           •Enter Find Mode [ Specified Find Requests: Find Records; Criteria: WorkOrder::PickupBillOfLadingPrinted: “=” AND WorkOrder::DernOrEndResult: “=The verify Inc” AND WorkOrder::PickupBillOfLadingPrintedDefine1: “=” ] [ Restore ]
           •Perform Find [ ]
           •Set Variable [ $HAWB; Value:"Attention Dispatch " & WorkOrder::DernOrEndResult & " job " & WorkOrder::Hawb ]
           •Set Variable [ $SavePU; Value:WorkOrder::Hawb & "-" & WorkOrder::PickupBillOfLadingPrintedNumberTimes + 1 & ".pdf" ]
           •Replace Field Contents [ WorkOrder::PickupBillOfLadingPrinted; Replace with calculation: "s" ] [ No dialog ]
           •Go to Layout [ “EndPuRouting” (WorkOrder) ]
           •Replace Field Contents [ WorkOrder::PickupBillOfLadingPrintedNumberTimes; Replace with calculation: WorkOrder::PickupBillOfLadingPrintedNumberTimes + 1 ] [ No dialog ]
           •Save Records as PDF [ File Name: “filewin:/c:/users/quick/desktop/Alerts/$savePU”; Current record ] [ Document - Compatibility: Acrobat 5 and later ] [ Pages - Number Pages From: 1; Include: Specific Pages; Start Page: 1; End Page: 1 ] [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ] [ Restore; No dialog ]
           •Send Mail [ Send via SMTP Server; To: Customer 2::AlertEmailA; CC: Customer 2::AlertEmailB; Subject: $HAWB; Message: "Follow directions per PDF and confirm receipt this e-mail."; Attachment: “filewin:/c:/users/quick/desktop/Alerts/$savePU”; Email Address: ""; Reply-To Address: ""; SMTP Server: "smtp.??.com"; Port: 465; Use SSL; Authentication Type: Plain Password; User Name: "unknown"; Password: "" ] [ No dialog ]
           •Go to Record/Request/Page [ Next; Exit after last ]
           •End Loop
           •Go to Layout [ “WorkOrder” (WorkOrder) ]
           •Show All Records

        • 1. Re: email

               Given this term in send mail: Email Address: ""

               Are you sure that this is working at all?

               Are you gettting PDF files that are named correctly or does each pdf produced in the loop have the name $SavePU ?

               You might take a look at these two loops for more on saving as PDF's and using a script to perform a find:

               Save As PDF: Found Sets to PDF with unique file names

               Scripted Find Examples: Scripted Find Examples (I see no errors in your find criteria, but this approach that uses set field steps to get the criteria into the correct fields make for script that is easier to read an analyze.)

          • 2. Re: email

                 when the "find" locates one record it saves pdf (names it correctly and locates it in desktop folder), sends email (to those specified) and changes field data so record wont be found again  -  if "find" locates two records it saves pdf and sends email for first record found not the second  -  any suggestions?    

            • 3. Re: email

                   ran another test and found out even though it names email attachment with correct name it has another pdf  -  let me run another test to see exactly what its doing

              • 4. Re: email

                     its nameing all the pdf's with the first record pdf name  -  therefore deleting the pdf's on desktop each time a new one is made  -   second record email has correct pdf but  wrong name  -  how do i get correct pdf name?  -  i thought saveing pdf to desktop and haveing button with pdf path was best way to go?  -  or should container field be used? 

                • 5. Re: email

                       got the pdf's to name correctly  -  would still like to know where pdf should be stored   desktop or container 

                  • 6. Re: email

                         Do you need the PDF after it is generated?

                         If so, insert it into a container field. If not, don't. If you don't need to retain it, I'd save it to the temporary folder.

                         For more on path variables and container fields, you might check out this thread and the exploration file you can download from it: Exploring the use of a $Path Variable in Scripts