Need some assistance.
I have created an email button to send a particular document to our customers. I have created an email template to be used whenever this email is sent. When the button is pressed to send the email, I would like for the relevant email template to display automatically without the user having to choose the template as I don't want to have the user select the wrong template and it also speeds up efficiency.
I have tried to make this work with a post in the community called "Create "New email" Buttons, and have each button automatically use the relevant template. However, it is not working for me.
I put this in my ASP page for the button...
var strTESTEmailLeaseButton = CRM.Button("TestEmail Lease","NewEmail.gif",CRM.URL("1500") + "&customTemplateId=1012");
I added this to my container block...
AddButton(strTESTEmailLeaseButton);
I added this to the custom content area of the EmailFilingBox in Communication..
<script>
// Add to EmailFilingBox
window.attachEvent( 'onload', function () {
// Using setTimeout is optional - I ran into problems
// changing the template before the FCKEditor had loaded
setTimeout( "doTemplateRedirect ()", 1000);
});
function doTemplateRedirect () {
var customTemplateIdRegEx = /customTemplateId=([0-9]+)/gi ;
if (customTemplateIdRegEx.test(document.location.href)) {
customTemplateIdRegEx.exec(document.location.href);
var newTemplateId = RegExp.$1;
if ($( "#template" ).val() != newTemplateId) {
$( "#_HIDDENtemplate" ).val(newTemplateId);
$( "#template" ).val(newTemplateId);
$( "#template" ).change();
}
}
}
When I press the button, the default template comes through and not my "relevant" template. This is the URL that I get when I hit my button...
http://sagecrm/CRM/eware.dll/Do?SID=107142790038959&Act=1500&Mode=1&CLk=T&Key0=1&Key1=1276341&Key2=1974054&customTemplateId=1012
Can anyone see what I am doing wrong?
Any assistance would be greatly appreciated. We are using 7.2
Thank you!