11 Replies Latest reply on Mar 31, 2016 2:40 AM by rrrichie

    FileMaker Server 13

    christian.fabbro@veolia.com

      Good morning

      I try to explain the problem.

       

      The problem is with FileMaker Server 13 with Windows Server 2012 R2 Environment.

      I created a program that performs a script once a day. The script reads the data in a table, creates a list of expiring orders and prepares a mail to be sent to a single adressee.

       

      The email has the following structure:

      - Subject of email: Expiring orders

      - Body of email: The following orders are expiring: + "#list of expiring orders".

       

      Problem: the adressee receives the e-mail but the "#list of expiring orders" is empty. Instead the list is not empty.

       

      If the script runs by (Alt + U) in the FileMaker Pro Advance 13 the mail is completed of all information.

       

      What could be causing this problem?

      Some resolution about?

       

      Thanks in advance for answers.

      Christian

        • 1. Re: FileMaker Server 13
          taylorsharpe

          Can you show us the script?  But without it, I recommend you step through the script to see what is happening.  Also, make the Body of the script a variable so you can see in the debugger the value before using it in the body of the email.  Make a variable $Body and do the calculation with the list of expiring orders and then just place the $Body in the email's body.  That way you can see the $Body calculation before the message is sent.

           

          Alt - U.... maybe Control-U for Preview mode?  Is it possible the window needs refreshing because Preview will force a refresh to occur on the layout.

          • 2. Re: FileMaker Server 13
            christian.fabbro@veolia.com

            "I recommend you step through the script to see what is happening.  Also, make the Body of the script a variable so you can see in the debugger the value before using it in the body of the email.  Make a variable $Body and do the calculation with the list of expiring orders and then just place the $Body in the email's body.  That way you can see the $Body calculation before the message is sent."


            The script that i create using the variables as you indicated.

            The script works fine in debug mode (the email is completed of all elements) but does not work if associated with a program in File Maker Server 13.


            Why?




            • 3. Re: FileMaker Server 13
              coherentkris

              why? because trying some diagnosis might help to solve the problem?

              • 4. Re: FileMaker Server 13
                Mike_Mitchell

                How is this script being executed? Server-side schedule? Perform Script on Server? Robot client?

                • 5. Re: FileMaker Server 13
                  christian.fabbro@veolia.com

                  It is "Perform Script on Server".

                  • 6. Re: FileMaker Server 13
                    christian.fabbro@veolia.com

                    Taylor,

                    The following is an extract of the script:

                     

                    Vai al formato [ “Elenco” (Elementi ordine) ]

                    Passa al modo Trova [ ]

                    Imposta campo [ Elementi ordine::Data scadenza garanzia ; Get(DataCorrente)& "..." & Get(DataCorrente)+15 ]

                    Esegui la ricerca [ ]

                    If [ Get(ContoTrovati)>0 ]

                    Imposta variabile [ $Oggetto; Valore:"Elementi Commessa in scadenza" ]

                    Imposta variabile [ $A; Valore:"x.y@z.com" ]

                    Imposta variabile [ $CCN; Valore:"x1.y1@z1.com;x2.y2@z2.com" ]

                    Imposta variabile [ $Body ; Valore:"I seguenti Elementi Commessa sono in scadenza: ¶¶¶" ]

                     

                    Ordina i record [ Mantieni record ordinati ; Ordinamento specificato: Elementi ordine::Data scadenza garanzia ;               ascendente ] [ Ripristina; Senza finestra ]

                     

                    Vai a Record/Richiesta/Pagina [ Primo ]

                    Imposta variabile [ $Commessa_Attuale ; Valore:Ordini::Numero offerta ]

                    Imposta variabile [ $Commessa_Precedente ; Valore:"" ]

                    Imposta variabile [ $Matricola; Valore:Elementi ordine::Matricola vis ]

                     

                    Loop

                    If [ $Commessa_Attuale != $Commessa_Precedente and $Matricola != "S.M." ]

                         Imposta variabile [ $Riga; Valore:"" ]

                        

                         Imposta variabile [ $Riga; Valore:StileTestoAgg("Matricola: " & Elementi ordine::Matricola vis;Grassetto) & " Data

                              garanzia: " & Elementi ordine::Data scadenza garanzia & " Commessa: " & Ordini::Numero offerta & "¶" &

                              "Codice: " & Elementi ordine::Codice macchina vis & " Modello: " & Elementi ordine::Modello visualizzato & "¶"

                              &"Acquirente: " & Elementi ordine::Nome acquirente & " Utilizzatore:" & Elementi ordine::Nome utilizzatore &

                               "¶¶" ]

                     

                         Imposta variabile [ $Body ; Valore:$Body & $Riga ]

                     

                    End If

                     

                    Vai a Record/Richiesta/Pagina [ Successivo; Esci dopo l'ultimo ]

                     

                    Imposta variabile [ $Commessa_Precedente ; Valore:$Commessa_Attuale ]

                    Imposta variabile [ $Commessa_Attuale ; Valore:Ordini::Numero offerta ]

                    Imposta variabile [ $Matricola; Valore:Elementi ordine::Matricola vis ]

                    End Loop

                     

                    Invia posta [ Invia tramite server SMTP ; a: $A; BCC: $CCN; Oggetto: $Oggetto; Messaggio: $Body; Nome: Menù

                    principale::Mail_smtp_nome; Indirizzo e-mail: Menù principale::Mail_smtp_email; Indirizzo di risposta: Menù principale::

                    Mail_smtp_email_risposta; Server SMTP: Menù principale::Mail_smtp; Porta: 25; Tipo autenticazione: Nessuno ]

                    [ Senza finestra ]

                     

                    End If

                    • 7. Re: FileMaker Server 13
                      Mike_Mitchell

                      If something works on the client, but doesn't work when executed server-side, check these:

                       

                      1) Are all the script steps Server-compatible?

                      2) What happens with the OnFirstWindowOpen and OnLastWindowClose triggers? Anything there that might be causing an issue?

                      3) What permissions are being used to log into the database on the server? Are there any issues with privileges that might be preventing the script from executing normally?

                       

                      When you use PSoS, the script doesn't run using the current client. It runs in a virtual session, essentially creating an artificial "client" on the server. This causes the normal opening script to fire, plus a new login. So check these variables.

                      • 8. Re: FileMaker Server 13
                        rrrichie

                        Don't forget that when you call Perfrom Script on Server that script starts in a new FileMaker session so you have to make sure it still is in the right table and record, found set etc...

                         

                        So this will not work :

                        1. Go to layout

                        2. find stuff

                        3. set variables

                        3. call psos script "mail it" ( with found set and variables )

                         

                        Happy Coding!

                        • 9. Re: FileMaker Server 13
                          christian.fabbro@veolia.com

                          If you can help below i write the reported event in the logs:


                          Module: Server events

                          Type: Informations

                          Event: 645

                          Description: Program "Elementi Commessa in scadenza" error script (3) in "Elementi ordine: Start: Set Use System Formats"


                          The script succeeds but I keep getting error 3 and I don't know why.

                          The error message is in the server log.

                          • 10. Re: FileMaker Server 13
                            Mike_Mitchell

                            Error 3 is “command unavailable” (http://www.filemaker.com/help/14/fmp/en/html/error_codes.html#1030072 <http://www.filemaker.com/help/14/fmp/en/html/error_codes.html#1030072>). It usually means the script step is not Server-compatible.

                             

                            It’s customary to bypass your startup script when executing server-side, since most of the startup stuff isn’t applicable. You can use this calculation:

                             

                                 PatternCount ( Get ( ApplicationVersion ) ; “Server” ) > 0

                             

                            and an If statement to exit the startup script if it’s being executed server-side.

                            • 11. Re: FileMaker Server 13
                              rrrichie

                              That's caused by the Set Use System Formats script step, which isn't compatible on Server.  But it will just skip it.

                               

                              It will only cause a problem if you scripts depends on date/time or , . (point, comma decimal)  formats.

                               

                              For example if your machine has 25-12-2015 format and file format is 12-25-2015... that script step won't be performed and so the format 25-12-2015 is not used in the script.