AnsweredAssumed Answered

Emailing Multi Page Emails

Question asked by DennyHayes on Sep 30, 2010
Latest reply on Oct 4, 2010 by DennyHayes

Title

Emailing Multi Page Emails

Post

Seems you can't email a multiple page email. This script works fine on a Mac, and you get one pfd file with multiple pages. But on the iPhone it only sends one page? A lot of this might seem confusing, because this script does some things while sending the email. Mainly it fills out a form to be saved. I'll try to attach an image of it.

Line 31, which is the choice for emailing the pdf with the found set, does run because it sets all of the field info into the form. But line 32 seems to only save the first page to the documents folder

***********************************************

  1. If [ IsEmpty ( Preliminary Quotes::Serious Errors ) ] 
  2.    #---- Send Quotation Email ---------------------------- 
  3.    If [ IsEmpty ( Correspondence::Contact Email ) = 0 ] 
  4.       Go to Layout [ “Quotation Printout” (Preliminary Quotes) ] 
  5.       Set Variable [ $Variable; Value:Get ( DocumentsPath ) & Right ( Year ( Get ( CurrentDate ) ) ; 2 ) &      
  6.       Right ( "0" & Month ( Get ( CurrentDate ) ) ; 2 ) & Right ( "0" & Day ( Get ( CurrentDate ) ) ; 2 ) & "-" & 
  7.          Right ( "0" & Hour ( Get ( CurrentTime ) ) ; 2 ) & Right ( "0" & Minute ( Get ( CurrentTime ) ) ; 2 ) & " " & 
  8.          Preliminary Quotes::Quotation ID & "           " & Preliminary Quotes::Customer & ".pdf" ] 
  9.       Set Field [ Preliminary Quotes::Global Variable A; $Variable ] 
  10.       Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] 
  11.       #---- Select Multiple Or Single Quotation Email ---------------------------- 
  12.       If [ Get ( FoundCount ) = Get ( RecordOpenCount ) or Get ( RecordOpenCount ) > 10 ] 
  13.          Save Records as PDF [ File Name: “$Variable”; Current record ] [ Document -  Compatibility: Acrobat 5 and later ] 
  14.             [ Pages -  Number Pages From: 1; Include: All pages ] 
  15.             [ Security -  Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] 
  16.             [ Initial View -  Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ] [ Restore; No dialog ] 
  17.       Else 
  18.          Go to Layout [ “Email” (Correspondence) ] 
  19.          Show Custom Dialog [ Message: "Do you want to email only the selected Single quotation, or all quotations in the Found set?"; 
  20.             Buttons: “Cancel”, “Single”, “Found” ] 
  21.          Go to Layout [ “Quotation Printout” (Preliminary Quotes) ] 
  22.          If [ Get ( LastMessageChoice ) = 1 ] 
  23.             Exit Script [  ] 
  24.          End If 
  25.          If [ Get ( LastMessageChoice ) = 2 ] 
  26.             Save Records as PDF [ File Name: “$Variable”; Current record ] [ Document -  Compatibility: Acrobat 5 and later ] 
  27.                [ Pages -  Number Pages From: 1; Include: All pages ] [ Security -  Printing: High Resolution; Editing: Any except extracting pages; 
  28.                Enable copying; Enable Screen Reader ] [ Initial View -  Show: Pages Panel and Page; Page Layout: Single Page; 
  29.                Magnification: 100% ] [ Restore; No dialog ] 
  30.          End If 
  31.          If [ Get ( LastMessageChoice ) = 3 ] 
  32.             Save Records as PDF [ File Name: “$Variable”; Records being browsed ] [ Document -  Compatibility: Acrobat 5 and later ] 
  33.                [ Pages -  Number Pages From: 1; Include: All pages ] [ Security -  Printing: High Resolution; Editing: 
  34.                   Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View -  Show: Pages Panel and Page; Page Layout: 
  35.                   Single Page; Magnification: 100% ] [ Restore; No dialog ] 
  36.              Go to Record/Request/Page [ First ] 
  37.             #---- Set Email Field Info ---------------------------- 
  38.             Loop 
  39.                Set Variable [ $VariableA; Value:$VariableA & 
  40.                   Case ( IsEmpty ( $VariableA ) = 0 ; " " ) & 
  41.                   Preliminary Quotes::Quotation ID ] 
  42.                   Set Variable [ $VariableB; Value:$VariableB & 
  43.                   Case ( IsEmpty ( $VariableB ) = 0 ; "¶" ) & 
  44.                      Preliminary Quotes::Quotation ID & " " & 
  45.                      Preliminary Quotes::Customer ] 
  46.                Go to Record/Request/Page [ Next; Exit after last ] 
  47.             End Loop 
  48.             Go to Layout [ “Email” (Correspondence) ] 
  49.             Set Field [ Correspondence::Reference; Substitute ( $VariableA ; " " ; ", " ) ] 
  50.             Set Field [ Correspondence::Company; "Quotation Nos: " & $Variable ] 
  51.             Send Quotation Via Email Correspondence: Send Quotation Via Email 
  52.             Set Field [ Correspondence::Company Address; "" ] 
  53.             Set Field [ Correspondence::Company City; "" ] 
  54.             Set Field [ Correspondence::Company State; "" ] 
  55.             Set Field [ Correspondence::Company Zip Entry; "" ] 
  56.             Set Field [ Correspondence::Quotation ID; Substitute ( $Variable ; " " ; "¶" ) ] 
  57.             Set Field [ Correspondence::Body; "     Quotations:¶" & $VariableB & "¶" ] 
  58.          End If 
  59.       End If 
  60.       #---- Send Email ---------------------------- 
  61.       Go to Layout [ original layout ] 
  62.       Set Error Capture [ On ] 
  63.       Send Mail [ Send via E-mail Client; To: Correspondence::Contact Email; CC: Correspondence::Email CC To; BCC: 
  64.          Correspondence::Email BCC To; Subject: Correspondence::Reference & 
  65.          Case ( 
  66.             IsEmpty ( Correspondence::Reference ) = 0 and 
  67.             IsEmpty ( Correspondence::Subject ) = 0 ; " - " ) & 
  68.             Correspondence::Subject; Message: Correspondence::Body; Attachment: “$Variable” ] 
  69.       Close Window [ Current Window ] 
  70.       #---- Update Activity Log ---------------------------- 
  71.       Set Variable [ $Variable; Value:Left ( DayName ( Get ( CurrentDate ) ) ; 3 ) & ", " & 
  72.                Case ( Month ( Get ( CurrentDate ) ) < 10 ; "  " ) & 
  73.                   Left ( GetAsText ( Get ( CurrentDate ) ) ;  Position ( GetAsText ( Get ( CurrentDate ) ) ; "/" ; 0 ; 1 ) - 1 ) & "/" & 
  74.                   Right ( "0" & Middle ( GetAsText ( Get ( CurrentDate ) ) ; Position ( GetAsText ( Get ( CurrentDate ) ) ; "/"; 0 ; 1 ) + 1 ; 
  75.                      Position ( GetAsText ( Get ( CurrentDate ) ) ; "/" ; 0 ; 2 ) - 
  76.                      Position ( GetAsText ( Get ( CurrentDate ) ) ; "/" ; 0 ; 1 ) - 1 ) ; 2 ) & "/" & 
  77.                   Right ( GetAsText ( Get ( CurrentDate ) ) ; 2 ) & ", " & 
  78.                   Right ( "0" & Left ( GetAsText ( Get ( CurrentTime ) ) ; 
  79.                      Position ( GetAsText ( Get ( CurrentTime ) ) ; ":" ; 0 ; 1 ) - 1 ) ; 2 ) & ":" & 
  80.                   Right ( "0" & Middle ( GetAsText ( Get ( CurrentTime ) ) ; 
  81.                      Position ( GetAsText ( Get ( CurrentTime ) ) ; ":" ; 0 ; 1 ) + 1 ; 
  82.                      Position ( GetAsText ( Get(CurrentTime ) ) ; ":" ; 0 ; 2 ) - 
  83.                      Position ( GetAsText ( Get ( CurrentTime ) ) ; ":" ; 0 ; 1 ) - 1 ) ; 2 ) & "; " & 
  84.                      Get ( SystemIPAddress ) & " - " & 
  85.                   Substitute ( Get ( SystemNICAddress ) ; "¶" ; " - " ) & " (" & Get ( UserCount ) & ") " & 
  86.                      Get ( UserName ) & " (" & Preliminary Quotes::Active User & ") " & 
  87.                         Preliminary Quotes::Quotation ID & "-" & Preliminary Quotes::Job ID & 
  88.                         " (" & Preliminary Quotes::Customer w Address & ")" & " - Email" ] 
  89.        Go to Layout [ “Activity Log” (Activity Log) ] 
  90.       New Record/Request 
  91.       Set Field [ Activity Log::Activity; $Variable ] 
  92.       If [ Get ( SystemPlatform ) 3 and Get ( SystemPlatform ) 4 ] 
  93.          Go to Layout [ “Data Input” (Preliminary Quotes) ] 
  94.       Else 
  95.          Go to Layout [ “iPhone Record Review” (Preliminary Quotes) ] 
  96.       End If 
  97.    Else 
  98.       Show Custom Dialog [ Message: "Email To address is missing"; Buttons: “OK” ] 
  99.    End If 
  100. Else 
  101.    Send Quotation Via EmailCorrespondence: Send Quotation Via Email 
  102.       Show Custom Dialog [ Title: "Serious Errors"; Message: "The following error(s) were found, and must be corrected before the 
  103.       quotation can be printed:" & "¶¶" & Preliminary Quotes::Serious Errors; Buttons: “OK” ] 
  104. End If 



Sotae.jpg

Outcomes