4 Replies Latest reply on Feb 3, 2017 1:03 AM by greatgrey

    Tracking a code fault


      Hi There,


      Can anyone please point me in the right direction as to how I can go about catching an error in a system. At one of my clients, every now and again a script doesn't work properly and I can't for the life me figure out where the issue is coming from. I had the issue again this morning where a credit note didn't post properly so I took the backup before and after the event and every time when I run it on my machine it runs as expected.


      The main issue is it happens so infrequently I can't seem to catch the error. Obviously all the error checking I am continuing to add to the script doesn't seem to be helping and I am pulling out what little hair I have left trying to figure out where the system is falling over. 


      Would maybe running the script with PSoS be a solution?

        • 1. Re: Tracking a code fault
          Johan Hedman

          At the beginning of your script your enter script step Set error capture On . Then you can with If check Get ( LastError ) to see what is happening.




          With PSoS you have to think about that FM is opening up your database totally clean. It is running your OnFirstWindowOpen script and all other script triggers that you have on layouts. So for those script you have to make sure you go through all step carefully before putting into production.

          1 of 1 people found this helpful
          • 2. Re: Tracking a code fault

            I think i was just freaking out this morning because even the Get(LastError) wasn't helping. I eventually put a backup on my clients machine and ran the file using her account and Bob's your Aunty the error happened.


            Turned out I was testing the scripts using the Full Admin account. When I ran the script using the users credentials I saw that the deleting of records is not allowed, so I have to add the Full Access Privilege to that script. Now it works.


            Talk about a rookie mistake.

            • 3. Re: Tracking a code fault
              Johan Hedman

              We all learn form our own mistakes

              • 4. Re: Tracking a code fault

                My guess is given the random nature of the error, if this is a multi-user file you are getting a locked record that is stopping it from completing the script.

                1 of 1 people found this helpful