CRM 7.1g
Hello All,
I created two fields in the leads module, assigned user email and phone, so that when their info can be added to the email template. The goal is to have the ability to send a mass email to all leads and have the contact info of the assigned user and not the person sending the email. I add table level script into the leads module but when I implement this, I am not able to open leads anymore. CRM just sits there loading the lead and I am not sure why. Here is the script below.
function PostInsertRecord()
{
var assigneduser = CRM.GetContextInfo('Lead','lead_assigneduserid');
var Query = CRM.CreateQueryObj("select * from users where user_userid = '"+assigneduser+"'");
Query.SelectSql();
while (!Query.eof){
Values("lead_assignedphone") = Query.FieldValue("user_phone");
Values("lead_assigneduseremail") = Query.FieldValue("user_emailaddress");
}
}
function UpdateRecord()
{
var assigneduser = CRM.GetContextInfo('Lead','lead_assigneduserid');
var Query = CRM.CreateQueryObj("select * from users where user_userid = '"+assigneduser+"'");
Query.SelectSql();
while (!Query.eof){
Values("lead_assignedphone") = Query.FieldValue("user_phone");
Values("lead_assigneduseremail") = Query.FieldValue("user_emailaddress");
}
}