AnsweredAssumed Answered

Deleting a record in a script

Question asked by MarkGores on Dec 18, 2014
Latest reply on Dec 18, 2014 by MarkGores


Deleting a record in a script


I have a file that imports csv files from UPS and FedEx shipping computer and combines them into one table containing the tracking number, date and our jobnumber.  I am trying to have the file update our jobs database by entering the tracking numbers with the jobs as they ship.

The shipping file is just meant to be transitory so I wanted to clear it out every day after the jobs file was updated.  I have been just using a lookup from the jobs file, but noticed I occasionally get an error saying a record couldn't be updated because another user was modifying it.  With no indication of which record that was, I don't want to delete the records and lose the tracking number for that job.  So I tried a looping script that goes to each shipping record, gets the job number, performs a find in the jobs file.  If a record is found it updates the ship date and tracking number fields, if not it sets an error marker in the shipping record.  Then goes back to the shipping file and if the error field is empty delete that record.  The problem is, it won't delete that record.  I get a "record is being modified by another user or in another window" and even if I exit the script I can't edit that record anymore.  Tried inserting a commit record step to make sure there aren't any active fields, tried using a set field to "NO" on the error field so I could go back and delete them later, but still no luck