AnsweredAssumed Answered

How do I get the current email address for the assigned user?

Question asked by polymerindustries polymerindustries on Apr 23, 2014
Latest reply on Jun 16, 2014 by raju raju
I have a custom field setup in Notes called Reply. 3 Bosses can Reply to the Notes made by our sales people.  They want the Assigned User to receive an Email when they Reply to the Note.  Simple enough with a Logic Hook.(or so I thought)

The Problem:
When I initially setup everyone's sugar account I set the email address to my own, so that I could setup everyone's passwords to match their email passwords. Then I set the email's to the user emails.

When calling the Assigned User Email in my logic hook, it is pulling the Original email set up for the user(my email), NOT the current email associated with the Assigned User.

Any help would be awesome.

Code for pulling assigned user's email below:
$sql = 'SELECT ea.email_address FROM email_addr_bean_rel eabr JOIN email_addresses ea ON eabr.email_address_id = ea.id WHERE eabr.bean_id = "'.$bean->assigned_user_id.'"';
$resp = $bean->db->query($sql, true); 
$row = $bean->db->fetchByAssoc($resp);      
$note_msg->AddAddress($row['email_address'], $row['last_name']);

Outcomes