Hi All
I have a query which checks if the lead status has been updated to “checked” , if the outcome is false I want suite to display an alert i.e. the status of this lead has not been set to checked. “button for OK”. The lead should then not be saved.
Can anyone help with this ?
my solution:
i created a before_save logic hook for the account module:
SugarApplication::appendErrorMessage('record cannot be saved !!!'.$errorMsg);
$params = array(
'module'=> 'Accounts',
'action'=>'DetailView',
'record' => $bean->id
);
SugarApplication::redirect('index.php?' . http_build_query($params).'&return_module=Accounts&return_action=DetailView&offset=1');
SugarApplication::appendErrorMessage —> will display the message
SugarApplication::redirect —> will prevent the record from being saved
it will work if you use action->edit->save. if you use a inline edit, it will mess up the browser. I switched them off in Admin->System settings.
p.s. you can use $_REQUEST variables for database comparison, and then display a message if its false ! . just put in
die(phpinfo(32));
to display all $GLOBALS !