Issue report by Dan Marks
Product
FileMaker ServerVersion
12Operating system version
Windows Server 2008R2Description 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) {
$recordID=$record->getRecordId();
// 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();
}