Hi Dears,
I am trying to execute an update event on selected records on list page with a button. However, before executing event I want to check a related record condition is met! I have tried to build following code as server event on this purpose.
// Put your code here.
global $dal;
while ( $data = $button->getNextSelectedRecord() )
{
//check support is done
$tblSupport = $dal->Table("mu_task_support");
$rs = $tblSupport->Query("IssueID=".$data["ID"]);
$data = db_fetch_array($rs);
if($data["Done"]=0)
System.out.println("There is unfinished job");
$result["txt"] = "Records not updated!";
$result["txt"] = $params["txt"]." NOT TERMINATED!";
break;
//end check
// set Closing Date today
$sql = "Update mu_task_tasks set Closing_Date=Now(), Active=0, Status=100, Percent_Complete=100 where ID=".$data["ID"];
CustomQuery($sql);
}
$result["txt"] = "Records were updated.";
$result["txt"] = $params["txt"]." Terminated!";
I have not succeeded to stop "while loop" if the related record condition returns false.
Can you help me to build a correct code