6 Replies Latest reply on Jun 12, 2013 6:44 AM by DLarsen

    Globals and Robot Machines

    DLarsen

      I have series of reports that I'm trying to automate. It's basically a sales report by region.

       

      What I'm trying to do is email a PDF for each region to the sales people that cover that region. There are a half dozen regions and maybe a half dozen people covering each region. Some sales people cover more than one region.

       

      I have a sales order table and I have a sales person table. In the sales person table there is a field for region and a value list of check boxes that allow me to indicate which region or regions a given person covers.

       

      I should probably mention that this is a Windows only deployment.

       

      Normally I would run automation on the server but since I need the report in PDF format, and sever-side scripts don't allow the creation of PDFs, I'm forced to run this using regular FMP on an unattended robot machine using the native Windows Scheduled Task feature.

       

      Basically I grab the full list of regions from value list and then walk through them one-by-one creating and saving the PDF. Then I go back and walk the list again this time setting a global field on the ORDERS table to the active region so I can pull the email addresses for the people assigned to that region.

       

      It all works fine if I run it manually but as a scheduled task it won't pull the email addresses.

       

      I've pretty much eliminated security as the problem as the account runs under [Full Access] in both files.

       

      The really odd thing is that if I manually log into the robot machine using the Agent credentials it works fine. If I run it without logging in using the scheduled task, it fails. BTW, the scheduled task is configured to run using the Agent credentials.

       

      This makes me think that global fields may not perform as expected unless the user is physically logged in. Has anybody else seen this?

        • 1. Re: Globals and Robot Machines
          sporobolus

          on 2013-06-11 8:53 DLarsen wrote

          It all works fine if I run it manually but as a scheduled task it won't pull the email addresses.

           

          can you clarify what happens to suggest "it won't pull"?

           

          This makes me think that global fields may not perform as expected unless the user is physically logged in. Has anybody else seen this?

           

          i don't think that global fields are the issue; i suspect the trouble is with

          the email process; having done a lot with robots (on Mac) i know they are hard

          to debug

           

          i would add some logging to your scripts to see if you can track down the

          problem; for a simple logging system, create a script that takes a string

          parameter and saves that string with a date stamp as a new record in a logging

          table, put calls to that script with appropriate message parameters at various

          milestones in your process

          • 2. Re: Globals and Robot Machines
            DLarsen

            Hi Steve,

             

            When I say it won't pull what I mean is when run manually I get a return separated list of email addresses.  When it runs in-the-background as a scheduled task, it just returns a question mark.

             

            I don't think it's an SMTP thing because I have a test mode built into the script. I initialize a script variable ($testMode) early on to either 0 (false) for norrmal operation or 1 (true) for test mode.  If $testMode = 1, before I do the actual SEND MAIL step I have it embed the email addresses into the body of the message and make myself the only recipient,  When I physically log in and run it I get an email with the other people's email addresses listed in the body.  If I have the scheduled task run the script the email is successfully sent but the body contains only a question mark.

             

            The other reason I suspect that the problem isn't SMTP is because I get undeliverable receipts in my mailbox.  This is an internal only delivery system and MS Exchange is good about informing the sender when a message cannot be delivered.  I see a copy of the actual message and there is just a question mark in the TO box.

            • 3. Re: Globals and Robot Machines
              sporobolus

              on 2013-06-11 12:21 DLarsen wrote

               

              When I say it won't pull what I mean is when run manually I get a return separated list of email addresses.  When it runs in-the-background as a scheduled task, it just returns a question mark.

               

              symptom of a corrupt index, or relation problem - is this a one-file solution?

              does it use file references? your hunch might be half-right, something about

              how the environment is different for a Windows scheduled task, but details of

              that are outside my experience

               

              if the scheduled task is the source of the problem, i'd consider keeping FMP

              running on the robot machine and using an onTimer script to kick off the task

               

              when i did some major PDF/robot setup it was before onTimer was available, but

              i kept FMP running and used a looping script to check for tasks in the form of

              records in a table; the PDF generation was on demand, not scheduled

               

               

              I don't think it's an SMTP thing because I have a test mode built into the script.

               

              yes, that's clear; it was just a guess from your brief description

              • 4. Re: Globals and Robot Machines
                DLarsen

                Hi Steve,

                 

                I'd think if it were a corrupt index it would be problematic no matter which method is being used.

                 

                It is indeed a two file solution and I've checked the relarionship and file references and security many times although sometimes the simplest errors are the toughest to find. (I'm embarrassed to tell you how close I came to replacing my clothes dryer one time only to discover that the plug had worked itself free from the recepticle)

                 

                I hesitate to use the on timer functionality because I think it requires FMP to be open and on the correct layout. That would be tough because this machine has a couple other non Filemaker tasks that it performs and I can't guarantee that when it gets used for other things that it will be returned to the proper state for the ON TIMER to work.

                 

                I've had another thought that I haven't been able to confirm yet. It could be that there is a domain policy preventing that robot machine from writing to the FP7 file. The other automated tasks the the robot machine does are read-only to the best of my knowledge but perhaps writing to the global field actually writes to the file.  I know we have a domain policy in place that prevents batch files from running under credentials other than that of the logged in user so perhaps it is one of these domain policies that is the problem.

                 

                If I figure out what the problem is I'll update this thread.

                • 5. Re: Globals and Robot Machines
                  gdurniak

                  perhaps you could try adding a "Relogin" script step,  in an "Opener" script,  so that if the Machine Name = "Robot", it would login as you do manually

                   

                  it also might work better on it's own machine,  so you could log in manually, then let it keep looping

                   

                  greg

                   

                   

                  > The really odd thing is that if I manually log into the robot machine using the Agent credentials it works fine. If I run it without logging in using the scheduled task, it fails.  BTW, the scheduled task is configured to run using the Agent credentials.

                  • 6. Re: Globals and Robot Machines
                    DLarsen

                    gdurniak,

                     

                    Thanks for the advice but it's already running under full access priviliges so I doubt the relogin would work especially since no user is physically logging onto the PC anyway and I'd really like to avoid having a PC devoted 24 x 7 to this one task that runs a for a whopping 60 seconds per week. We are already running FM server and which is the perfect place for this kind of thing but sadly, FMS doesn't produce PDFs.

                     

                    I'm going to put this project on hold until next week when our senior Windows networking guy can offer some assistance with domain policies and the complicated web that is Windows security.