My goal is to email the current record with a button on the list page. However, I need to update the record first.
This is my code on Server tab.
$record = $button->getCurrentRecord();
{
$sql = "UPDATE ICar
SET PMOSupport=1
where idicar=" .$record["idicar"];
DB::Exec($sql);
}
$body = "";
while( $record = $button->getCurrentRecord() )
{
$body .= "Number: " . $record['Inumber'] . "\n";
$body .= "Location: " . $record['Location'] . "\n";
$body .= "Employee: " . $record['Who'] . "\n-----------\n\n";
}
// send the email
$email = "test@test.com";
$subject = "Sample subject";
$arr = runner_mail(array('to' => $email, 'subject' => $subject,'body' => $body));