Email templates not loading

Check out this proposed fix.

https://github.com/salesagility/SuiteCRM/pull/7282/commits/903abbce358473c8e99d6817da1622b1a363726f

now with the new update to version 7.11.15 it seems to work correctly :slight_smile:

1 Like

Yea sorry I didn’t reply with my fix but on github the immediate fix was simply using your previous version’s popup_helper.js file. Used the one from 7.10.15 and that was a quick fix. Good to see some other solutions though

Installed 7.11.5 and the email template still does not load, is there a go around?

Please run the Javascript repairs from Admin / Repairs and try again, tell me how it goes. Thanks

Still did not work

I confirm that it works for me.
I start from a 7.11.14 installation, I don’t know if it can help.
If you need to compare a few files, they are available.

@mrprofit which version of these files do you have, the one on the left-hand side, or the right-hand side?

https://github.com/salesagility/SuiteCRM/pull/7282/commits/903abbce358473c8e99d6817da1622b1a363726f

function closePopup(){var closePopup=window.opener.get_close_popup();if(closePopup){window.close();}}
function confirmDialog(arrayContents,formName){var newData=’’;var labels=’’;var oldData=’’;SUGAR.util.globalEval(“var data = {”+arrayContents.join(",")+"}");var opener=window.opener.document;for(var key in data){var displayValue=replaceHTMLChars(data[key]);if(opener.forms[formName]&&opener.getElementById(key+’_label’)!=null&&!key.match(/account/)){var dataLabel=opener.getElementById(key+‘label’).innerHTML.replace(/\n/gi,’’).replace(/</?[^>]+(>|$)/g,"");labels+=dataLabel+’ \n’;newData+=dataLabel+’ ‘+displayValue+’\n’;if(window.opener.document.forms[formName].elements[key]){oldData+=dataLabel+’ ‘+opener.forms[formName].elements[key].value+’\n’;}}}
var popupConfirm=0;if(data[‘account_id’]&&(newData.split("\n").length-1)>2){if(newData!=oldData&&oldData!=labels){if(confirm(SUGAR.language.get(‘app_strings’,‘NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM’)+’\n\n’+newData)){popupConfirm=1;}else{popupConfirm=-1;}}}
return popupConfirm;}
function send_back(module,id){let associated_row_data=associated_javascript_data[id];let request_data=JSON.parse(window.document.forms[‘popup_query_form’].request_data.value);let passthru_data=Object();if(typeof(request_data.passthru_data)!=‘undefined’){passthru_data=request_data.passthru_data;}
let form_name=request_data.form_name;let field_to_name_array=request_data.field_to_name_array;SUGAR.util.globalEval(“var call_back_function = window.opener.”+request_data.call_back_function);let array_contents=Array();let fill_array_contents=function(the_key,the_name){let the_value=’’;if(module!==’’&&id!==’’){if(associated_row_data[‘DOCUMENT_NAME’]&&the_key.toUpperCase()===“NAME”){the_value=associated_row_data[‘DOCUMENT_NAME’];}else if((the_key.toUpperCase()===‘USER_NAME’||the_key.toUpperCase()===‘LAST_NAME’||the_key.toUpperCase()===‘FIRST_NAME’)&&typeof(is_show_fullname)!=‘undefined’&&is_show_fullname&&form_name!==‘search_form’){the_value=associated_row_data[‘FULL_NAME’];}else{the_value=associated_row_data[the_key.toUpperCase()];}}
if(typeof(the_value)==‘string’){the_value=the_value.replace(/\r\n|\n|\r/g,’\n’);}
array_contents.push(’"’+the_name+’":"’+the_value+’"’);};for(let the_key in field_to_name_array){if(the_key!==‘toJSON’){if(YAHOO.lang.isArray(field_to_name_array[the_key])){for(let i=0;i<field_to_name_array[the_key].length;i++){fill_array_contents(the_key,field_to_name_array[the_key][i]);}}else{fill_array_contents(the_key,field_to_name_array[the_key]);}}}
let popupConfirm=confirmDialog(array_contents,form_name);let name_to_value_array=JSON.parse(’{’+array_contents.join(",")+’}’);closePopup();let result_data={“form_name”:form_name,“name_to_value_array”:name_to_value_array,“passthru_data”:passthru_data,“popupConfirm”:popupConfirm};call_back_function(result_data);}
function send_back_teams(module,form,field,error_message,request_data,form_team_id){let array_contents=Array();if(form_team_id){array_contents.push(form_team_id);}else{for(let i=0;i<form.elements.length;i++){if(form.elements[i].name===field){if(form.elements[i].checked===true){array_contents.push(form.elements[i].value);}}}}
if(array_contents.length===0){window.alert(error_message);return;}
let array_teams=new Array();for(let team_id in array_contents){if(typeof array_contents[team_id]==‘string’){let team={“team_id”:associated_javascript_data[array_contents[team_id]].ID,“team_name”:associated_javascript_data[array_contents[team_id]].NAME};array_teams.push(team);}}
let passthru_data=Object();if(typeof request_data.call_back_function==‘undefined’&&typeof request_data==‘object’){request_data=YAHOO.lang.JSON.parse(request_data.value);}
if(typeof(request_data.passthru_data)!=‘undefined’){passthru_data=request_data.passthru_data;}
let form_name=request_data.form_name;let field_name=request_data.field_name;closePopup();SUGAR.util.globalEval(“var call_back_function = window.opener.”+request_data.call_back_function);let result_data={“form_name”:form_name,“field_name”:field_name,“teams”:array_teams,“passthru_data”:passthru_data};call_back_function(result_data);}
function send_back_selected(module,form,field,error_message,request_data){let array_contents=Array();let j=0;for(let i=0;i<form.elements.length;i++){if(form.elements[i].name===field){if(form.elements[i].checked===true){++j;array_contents.push(’"’+"ID
"+j+’":"’+form.elements[i].value+’"’);}}}
if(array_contents.length===0){window.alert(error_message);return;}
SUGAR.util.globalEval(“var selection_list_array = {”+array_contents.join(",")+"}");let passthru_data=Object();if(typeof(request_data.passthru_data)!=‘undefined’){passthru_data=request_data.passthru_data;}
let form_name=request_data.form_name;closePopup();SUGAR.util.globalEval(“var call_back_function = window.opener.”+request_data.call_back_function);let result_data={“form_name”:form_name,“selection_list”:selection_list_array,“passthru_data”:passthru_data,“select_entire_list”:form.select_entire_list.value,“current_query_by_page”:form.current_query_by_page.value};call_back_function(result_data);}
function toggleMore(spanId,img_id,module,action,params){toggle_more_go=function(){oReturn=function(body,caption,width,theme){$(".ui-dialog").find(".open").dialog(“close”);var el=’#’+spanId+’ img’;if(action==‘DisplayInlineTeams’){el=’#’+spanId;}
var $dialog=$(’

’).html(body).dialog({autoOpen:false,title:caption,width:300,position:{my:‘right top’,at:‘left top’,of:$(el)}});var width=$dialog.dialog(“option”,“width”);var pos=$(el).offset();var ofWidth=$(el).width();if((pos.left+ofWidth)-40<width){$dialog.dialog(“option”,“position”,{my:‘left top’,at:‘right top’,of:$(el)});}
$dialog.dialog(‘open’);}
success=function(data){SUGAR.util.globalEval(data.responseText);SUGAR.util.additionalDetailsCache[spanId]=new Array();SUGAR.util.additionalDetailsCache[spanId][‘body’]=result[‘body’];SUGAR.util.additionalDetailsCache[spanId][‘caption’]=result[‘caption’];SUGAR.util.additionalDetailsCache[spanId][‘width’]=result[‘width’];SUGAR.util.additionalDetailsCache[spanId][‘theme’]=result[‘theme’];ajaxStatus.hideStatus();return oReturn(SUGAR.util.additionalDetailsCache[spanId][‘body’],SUGAR.util.additionalDetailsCache[spanId][‘caption’],SUGAR.util.additionalDetailsCache[spanId][‘width’],SUGAR.util.additionalDetailsCache[spanId][‘theme’]);}
if(typeof SUGAR.util.additionalDetailsCache[spanId]!=‘undefined’)
return oReturn(SUGAR.util.additionalDetailsCache[spanId][‘body’],SUGAR.util.additionalDetailsCache[spanId][‘caption’],SUGAR.util.additionalDetailsCache[spanId][‘width’],SUGAR.util.additionalDetailsCache[spanId][‘theme’]);if(typeof SUGAR.util.additionalDetailsCalls[spanId]!=‘undefined’)
return;ajaxStatus.showStatus(SUGAR.language.get(‘app_strings’,‘LBL_LOADING’));url=‘index.php?module=’+module+’&action=’+action+’&’+params;SUGAR.util.additionalDetailsCalls[spanId]=YAHOO.util.Connect.asyncRequest(‘GET’,url,{success:success,failure:success});return false;}
SUGAR.util.additionalDetailsRpcCall=window.setTimeout(‘toggle_more_go()’,250);}
SUGAR.util.doWhen(“window.document.forms[‘popup_query_form’] != null "
+”&& typeof(window.document.forms[‘popup_query_form’].request_data) != ‘undefined’",function(){if(window.document.forms[‘popup_query_form’].request_data.value==""){window.document.forms[‘popup_query_form’].request_data.value=window.opener.get_popup_request_data();}});$(document).ready(function(){$(“ul.clickMenu”).each(function(index,node){$(node).sugarActionMenu();});});

Ouch! So that would seem to be the right-hand side, so it means you have the updated code.

This leaves me a bit stumped. I can’t think of a reason why it seems to be failing only in your system

:huh:

I’m experiencing this issue in my “New” installation of 7.11.4 but my existing installation that was upgraded to 7.11.4 works fine. I tried applying the patch on github but it’s not working for me at the moment. (going to try repairing/rebuilding JS files too).

Exact same problem, when I create an email and then then add a template, nothing happens. There are a bunch of JS errors in console.

OK got it working with the patch.

7282

The trick is:

  1. replace the files
  2. Quick repair and rebuild
  3. Repair JS Files

I also am using cloudflare so had to clear the cache and Shift F5 to clear the browser cache and it works!

If your hosting is using a cache you might want to make sure that’s clear too.

1 Like

Thank you that works.

Hello there, seems like you solved the email populating the body issue. I am not a programmer but know enough to be dangerous :slight_smile:

That said, how exactly do I grab the two files you referenced? I see commits etc but what do I actually copy and paste into a new file?

Thanks in advance for any help you can provide.

Martin

Hey mdraeger, this issue is solved in later versions, easiest way is just to apply the upgrade.

If not, then go to Gitub and download the two files.

You click in the top right hand corner with the three dots and it gives you the option to “view file”

Once there you’ll see three buttons: Raw, Blame, History

Right click on RAW and save the file to your desktop.

Do that for both files and replace them in the SuiteCRM directories they came from.

Thank you for the clear instructions, that helps.

I am using Version 7.11.8

Sugar Version 6.5.25 (Build 344)

I am still getting this issue where the template body text doesn’t show when selecting a template to compose an email.

Are you suggesting that the version I have should have the fix?

Martin

I’m on 7.11.8 and it works for me.

If you just upgraded, do a quick repair and rebuild and also flush your browser cache.

I followed the rebuild, emptied cache, still no body populating. I guess I will need to look for another solution.

Thanks for the quick reply.

Martin

Thinking about it last night. I just assumed it was fixed because it worked after upgrade. I had applied the patch previously. However, if the files were not changed in the upgrade, I’d still be running on the files I patched.

Long story short. Try the patch.

Okay I will try it right now. However, when I select the two files, the names are exactly the same. Should they be different?