Jump to content

Need some urgent help with pre-written email script from FM Starting Point 4


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

Recommended Posts

Hi everyone,

 

I am just in the process of amending FM Starting Point 4 to my requirements and have gotten quite far (with the help of some pros from here) for a rooky.

 

The solution has a lot of bugs and one is anoyoing. Unfortunately I am lacking the exprience to interprete complex scripts. The invoicing layout has an email script but instead of getting me to the email client it gets me into preview mode and thats it.

 

Here the copy of the script:

 

Allow User Abort [Off]

Commit Records/Requests [No dialog]

Freeze Window # Set Variable [$email; Value:T12_INVOICES::Contact_Email] # #--------------------------------------Checks to make sure there is a Contact attached with an email address If [IsEmpty ( T12_INVOICES::Contact_Email )]

Show Custom Dialog [Message:"The Contact for this Invoice does not have an email address."; Default Button:“OK”, Commit: “Yes”]

Exit Script [ ]

End If #--------------------------------------Limits the current found set to the current record in a new window. (to preserve found set) #--------------------------------------Sets variables with the current Invoice ID

Set Variable [$id; Value:T12_INVOICES::ID_Invoice] #--------------------------------------Navigate to Invoice print detail layout If [PatternCount (T12k_invoices_PREFERENCES||id_constant::flag_Invoice_Print ; "Basic" )]

Go to Layout [“L97_INVOICES_Print_Detail_Simple” (T12_INVOICES)]

Else If [PatternCount (T12k_invoices_PREFERENCES||id_constant::flag_Invoice_Print ; "Modern" )]

Go to Layout [“L96_INVOICES_Print_Detail” (T12_INVOICES)]

End If Perform Script [“ (0017) Print_Page_Setup_Portrait_8.5_by_11”] # #If the user pressed the "Email" button, the path and name variables are set #and a PDF of the Invoice Report is created in the Temporary Items folder of the user's machine

Set Variable [$FileName; Value:"Invoice_" & $id & ".pdf"]

Set Variable [$PDFPath; Value:Get ( TemporaryPath ) & $FileName]

Save Records as PDF [File Name:“$PDFPath” OR “filemac:$FileName” OR “filewin:$FileName”;Current record ] [Document -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] #--------------------------------------Send email with invoice pdf attached If [T12k_invoices_PREFERENCES||id_constant::flag_Email_Option = "Email Client"]

Send Mail [Send via E-mail Client; To: $email; Subject: T12l_invoices_PROJECTS||id_project|::Project_Name & " Invoice"; Message: "Hello " & T12b_invoices_CONTACTS||id_contact::Name_First & "," & ¶ & ¶ &

 

"Attached to this email you will find an Invoice for your " & T12l_invoices_PROJECTS||id_project|::Project_Name & " project. If there is any problem in opening this document or if the document was not attached at all, please let us know." & ¶ & ¶; Attachment:“$PDFPath” OR “filemac:$PDFPath” OR “filewin:$PDFPath” ]

Else If [T12k_invoices_PREFERENCES||id_constant::flag_Email_Option = "SMTP Server"]

Send Mail [Send via SMTP Server; To: $email; Subject: T12l_invoices_PROJECTS||id_project|::Project_Name & " Invoice"; Message: "Hello " & T12b_invoices_CONTACTS||id_contact::Name_First & "," & ¶ & ¶ &

"Attached to this email you will find an Invoice for your " & T12l_invoices_PROJECTS||id_project|::Project_Name & " project. If there is any problem in opening this document or if the document was not attached at all, please let us know." & ¶ & ¶; Attachment:“$PDFPath” OR “filemac:$PDFPath” OR “filewin:$PDFPath”; Name:T12k_invoices_PREFERENCES||id_constant:: SMTP_Name; Email Address: T12k_invoices_PREFERENCES||id_constant::SMTP_Email_Address; Reply-To Address: T12k_invoices_PREFERENCES||id_constant::SMTP_Reply_To_Address; SMTP Server: T12k_invoices_PREFERENCES||

November 21, 2014 22:02:34-1-Bioclean DB as of Nov 18th 1.fmp12 - (1101) INV_Email_Invoice_Form

INVOICES (1100-1199): INV_processes: (1101) INV_Email_Invoice_Form T12k_invoices_PREFERENCES||id_constant::Outgoing_SMTP_Server; Port: T12k_invoices_PREFERENCES|| id_constant::Port; Authentication Type:None ] [No dialog]

End If # Go to Layout [original layout]

 

Could someone tell me what is wrong here. As I have said, it is a pre written script and all the other layouts like Estimates, etc work fine as email attachment. Just this one seems to have a but. Sorry if some caracters do not show correctly but copy/paste did work this way. 

Any help is appreciated

Link to comment
Share on other sites

In the meantime, I have at leas found out where the script stops working. Maybe someone could help. 

 

Else If [PatternCount (T12k_invoices_PREFERENCES||id_constant::flag_Invoice_Print ; "Modern" )]

Go to Layout [“L96_INVOICES_Print_Detail” (T12_INVOICES)]

End If

Perform Script [“ (0017) Print_Page_Setup_Portrait_8.5_by_11”]

 

I am still taken to the [“L96_INVOICES_Print_Detail” (T12_INVOICES)] layout. But after End If it does not perform (0017) Print_Page_Setup_Portrait_8.5_by_11, which is a basic 3 liner  print setup script.

 

Anyone here can help??? 

Link to comment
Share on other sites

Hi Amerioca,

 

We have squished a bunch of bugs... but if your using a older version... then I can understand your problem.   Current release is 4.2v4.

 

Have you watched the script Debugger on this.  There are OnLayout Load Script Triggers...that fire for most of the data entry screens.

 

You need to watch the Debugger to see the sequence of failures here.

 

- Richard

Link to comment
Share on other sites

Tnx Richard. I am a relative roockie. I have solved the problem with simply copy and ammended the "Send Estimates" script it seems to work fine. Unfotunately I am to far ahead with amending the 4 version to my purposes, that I can easily switch to the newer one. 

 

Just one more question. I am trying to avoid that anyone is able to send and invoice before not having the invoiced items commited to the inventory. What would be the adequate script step? 

Link to comment
Share on other sites

Two ways to do that...that come to mind... but there are others.

 

The Commit Inventory button calls script 1116.   

 

In that script we set a field flag_items_committed 

 

We set this to 1... when the invoice is committed.  The field is empty it is not committed.

 

So in you print script I would ad this before things get going.

 

If flag_items_committed ≠ 1

   Exit (or halt) you decide

End if

Link to comment
Share on other sites

Tnx a lot Richard. Seems to work that way. Maybe you can help with another issue. Whenever a product is out of stock the Amount_in_Stock turns into a negative number. I would like to add a script, which does not even allow the user to add products which are out of stock. Meaning where the  Amount_in_Stock < 1. Would you be able to tell me which script I have to change and provide the script step? Tnx once again for all your help.

Link to comment
Share on other sites

Richard, pls ignore the above posting. I have simply given the QTY field a validation. Hence it still creates problems tranfering Estimates to Invoices but does the job for the time being.

 

Tnx again for your support.

Link to comment
Share on other sites

  • 1 month later...

Ok, for everyone who read this thread, there is now a dedicated walk through video that coverts the Transfer Process in FMSP... From Estimates to Invoices.  16 Minute Video.

 

Part of the Pro 13 Video Training Course ...$ 39.99

 

0210 - FMSP Estimate to Invoice Transfer Button - Customize it!

FMSP Transfer System... Estimates to Invoices

Understanding the process of customizing Estimates to Invoices transfer system in FMSP.  Also good for understanding how to move or copy complex records from one table... to another.

Link to comment
Share on other sites

This topic is 2879 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
 Share

×
×
  • Create New...

Important Information

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