2 Replies Latest reply on Feb 26, 2014 5:38 AM by willrollo

    attach two exported pdfs to a single email

      Title

      attach two exported pdfs to a single email

      Post

           Hi

           I have a script that creates a pdf and emails it as an attachment. However, I want the same email to contain two different attachments. I can only seem to get it to create one. Any ideas? Script below...The attachment that is not being created is highlighted in red...thank you

            

             
      •           #Email Order
      •      
      •           If [ Get(ScriptParameter) = "Order" ]
      •      
      •           If [ INVOICE DETAILS::Deposit raised = "" ]
      •      
      •           Show Custom Dialog [ Title: "Message"; Message: "You cannot email this order until you have selected whether the customer is to pay a deposit. Please click the Green tick button."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •           Set Variable [ $Subject; Value:Substitute (invoicedetails_PREF::gEmailSubject; "<<InvNum>>"; INVOICE DETAILS::fk_Order &" Confirmation" ) ]
      •      
      •           Set Variable [ $Body; Value:"Dear" & INVOICE DETAILS::Billing_Contact &", " & "¶Please find attached our order confirmation and acknowledgement. " & If(INVOICE DETAILS::Include Return Signed form = 1; "Please sign the order form and return to us so that we can begin manufscture. ") ]
      •      
      •           Set Variable [ $To; Value:INVOICE DETAILS::Billing_Email ]
      •      
      •           Set Variable [ $ORDERID; Value:INVOICE DETAILS::ID_Invoice_pk ]
      •      
      •           Freeze Window
      •      
      •           Commit Records/Requests [ Skip data entry validation; No dialog ]
      •      
      •           If [ Count(invoicedetails_INVOICEITEM::ID_InvoiceLI_pk) ]
      •      
      •           #Test for line items
      •      
      •           Go to Related Record [ From table: “invoicedetails_INVOICEITEM”; Using layout: “Confirmation” (INVOICEITEMS) ] [ Show only related records ]
      •      
      •           View As [ View as List ]
      •      
      •           Else
      •      
      •           Show Custom Dialog [ Title: "Warning"; Message: "There are no line items on this order."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode
      •      
      •           Show/Hide Toolbars [ Show ]
      •      
      •           Adjust Window [ Resize to Fit ]
      •      
      •           Go to Record/Request/Page [ Last ]
      •      
      •           Set Field [ PREF::gPageNumber; Get(PageNumber) ]
      •      
      •           Go to Record/Request/Page [ First ]
      •      
      •           Set Variable [ $Path; Value:"file:" & Get(TemporaryPath) & "Order " & Invoiceitems_INVOICEDETAILS::Reference & ".pdf" ]
      •      
      •           Save Records as PDF [ File Name: “$Path”; Records being browsed ] [ Document - Title: "Inv " & INVOICE DETAILS::ID_Invoice_pk; Compatibility: Acrobat 5 and later ] [ Pages - Number Pages From: 1; Include: All pages ] [ 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 ]
      •      
      •           Go to Layout [ original layout ]
      •      
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OrderID” ] [ Restore ]
      •      
      •           Go to Related Record [ From table: “INVOICE DETAILS”; Using layout: “Acknowledgement” (Invoiceitems_INVOICEDETAILS) ] [ Show only related records ]
      •      
      •           Show/Hide Toolbars [ Show ]
      •      
      •           Adjust Window [ Resize to Fit ]
      •      
      •           Go to Record/Request/Page [ Last ]
      •      
      •           Set Field [ PREF::gPageNumber; Get(PageNumber) ]
      •      
      •           Go to Record/Request/Page [ First ]
      •      
      •           Set Variable [ $ACK; Value:"file:" & Get(TemporaryPath) & "Ack " & Invoiceitems_INVOICEDETAILS::Reference & ".PDF" ]
      •      
      •           Save Records as PDF [ File Name: “$ACK”; Records being browsed ] [ Document - Title: "Inv " & INVOICE DETAILS::ID_Invoice_pk; Compatibility: Acrobat 5 and later ] [ Pages - Number Pages From: 1; Include: All pages ] [ 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 ]
      •      
      •           If [ Get(LastError) ≠ 0 ]
      •      
      •           #Test PDF creation and save
      •      
      •           Show Custom Dialog [ Title: "Warning"; Message: "There was a problem creating the PDF, Email cancelled."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •           Send Mail [ Send via E-mail Client; To: $To; Subject: "Club Fender Order"; Message: $body; Attachment: “$Path” OR “$ACK” ]
      •      
      •           If [ Get (LastError) = 0 ]
      •      
      •           #Set Email TimeStamp
      •      
      •           Enter Browse Mode
      •      
      •           Go to Layout [ “Order” (INVOICE DETAILS) ]
      •      
      •           Set Field [ INVOICE DETAILS::TimeStamp_Emailed Order; Get (CurrentTimeStamp) ]
      •      
      •           End If
      •      
      •           Go to Layout [ original layout ]
      •      
      •           End If