AnsweredAssumed Answered

PHP CWP Error Code 101 - Record Is Missing

Question asked by danmarks on Nov 26, 2013
Latest reply on Dec 12, 2013 by danmarks


PHP CWP Error Code 101 - Record Is Missing


FileMaker Server



Operating system version

Windows Server 2008R2

Description of the issue

A PHP script runs every 2 minutes to look at a table in my database called SMS. If it finds any records it grabs them, sends the SMS (via a different API) then edits the record and marks them as sent.

This generally works fine, sending 100s a day. However, every couple of months it crashes. It grabs a record from the table, sends the SMS, but when it goes to update the record the script exits with error 101 Record Is Missing. My logs show that it tried to use the correct record id to update the record.

Once I had manually marked the record as sent, it continued to send and mark the others fine.

Here is the code;

             #create the find command and specify the layout
        $findCommand =& $fm->newFindCommand('CWPSMS');

        #Specify the field and value to match against.
        $findCommand->addFindCriterion('status', "Queued");

        #Perform the find
        $result = $findCommand->execute();
                  #Store the matching record

               foreach ($records as $record) {

                    // Get records from found set

               $records = $result->getRecords();

//text api

$respondent_data = array(
                                            'sent_time'            => $time,
                                                       'sms_status'            => $sms_status,
                                                       'sms_msgid'            => $sms_msgid,
                                                       'sms_schid'            => $sms_schid,
                                                       'status'               => 'PENDING'

         $newEdit =& $fm->newEditCommand('CWPSMS', $recordID, $respondent_data);
          $result = $newEdit->execute();

Steps to reproduce the problem

The script ran 5 times, and produced the same error with the same record.

Expected result

The script to update the record.

Actual result

Returned error 101 Record is missing

Exact text of any error message(s) that appear

101 Record is missing