Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created July 4, 2014 12:32
Show Gist options
  • Save matthewpoer/3bf248e43d98ebd6f5ec to your computer and use it in GitHub Desktop.
Save matthewpoer/3bf248e43d98ebd6f5ec to your computer and use it in GitHub Desktop.
SugarCRM: How to get a record's email address in Sugar7 API vs. legacy services (including web to lead form entrypoint)
class myClass{
public function myMethod($bean,$event,$arguments){
// if we are using a legacy API or web-to-lead form, email address is in email1
$GLOBALS['log']->fatal("email1 value: {$bean->email1}");
// but if we're on that sugar7 API or sugar7 interface (which uses said API...)
$sea = new SugarEmailAddress();
$email = $sea->getPrimaryAddress($bean);
$GLOBALS['log']->fatal("sea value: {$email}");
$GLOBALS['log']->fatal("Request: " . print_r($_REQUEST,true));
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment