On the Case
object page, there is an Emails
related list which has a Send an Email
button taking the user to another page to fill in the email.
I haven't been able to find a way to override the functionality of this Send an Email
button, or customise the Emails related list in any way. All I want to do is to manipulate the URL onclick so that the p26
parameter is set which will set the email From:
address to a certain value.
I have done this by creating a custom Send an Email
button and adding it to the Case page, but the Send an Email
button on the Emails
related list is still there of course, so if users press that one then they don't get the custom functionality.
Is there anyway I can override the default functionality, or remove the standard Send an Email
button?
Thanks
Attribution to: Joe
Possible Suggestion/Solution #1
Possible workaround is to simply remove "Send An Email" on the related list. Create a custom button on the CASE record itself not the activity history related list, not a direct port of the feature but workable anyways
Attribution to: Edward F. Encarnacion
Possible Suggestion/Solution #2
I believe you will have to remove the button from the related list and add your own custom button.
1) To remove the button when in the edit layout page
- Click the small spanner top left of the Email Object Related List
- At the bottom of the light window that appears is a folded up section called Buttons, Click the '+' symbol
- Untick the
Send an Email
standard button.
2) Create a new button for the Email Object that uses the custom link that you need
- Goto Setup -> Customise -> Email -> Buttons and Links
- Create a new custom button with type List (http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_define_custom_buttons.htm)
- Set the URL to be the same as that of the standard button only with your new parameter
- Use the same page as 1) to add your new button
Attribution to: Jon Hazan
Possible Suggestion/Solution #3
In order to change the link URL for the New Email
button, you have to use a Javascript hack. Create a new "narrow" Homepage Component (really a Sidebar component, but SFDC calls them Homepage components) and paste the following code in (be sure to check off Show HTML
first, so that this is entered as code, not as text)
<div id="remove-shortcut-id">
Click "Show HTML" to see hidden javascript code.<br/>
<b>DO NOT SAVE UNLESS JAVASCRIPT IS VISIBLE</b> or else that code will be erased.
</div>
<script type="text/javascript"><!--
function changeNewEmailQuery() {
var PARAMETERS_TO_ADD = 'p26=add_it_here&other=if_another_one';
var cid = window.location.pathname.replace('\/', '');
if (cid.indexOf('500') != 0) return;
var newEmailBtn = document.getElementsByName("newEmail");
if (newEmailBtn[0] && newEmailBtn[0].query_fixed == false) {
var btn = newEmailBtn[0];
var fn = btn.onclick.toString()
var navUrl = fn.match(/navigateToUrl\('([^']*)'.*/)[1];
navUrl = navUrl + "&" + PARAMETERS_TO_ADD;
btn.onclick = function (event) { navigateToUrl(navUrl, null, 'newEmail'); };
btn.query_fixed = true;
}
}
/* Run immediately on page load and queue for second run after related lists load */
changeNewEmailQuery();
setTimeout('changeNewEmailQuery();', 100);
/* hide this component */
document.getElementById('remove-shortcut-id').parentElement.style.display = 'none';
--></script>
Save this component and add it to your Homepage layout as a narrow column. The code will run on each page load, and whenever it sees the NewEmail, it will edit the query string.
(Fixed doublequote issue)
Attribution to: Benj
Possible Suggestion/Solution #4
This cannot be done. The Send an Email button on the Emails related list cannot be removed, customized, or otherwise modified. I attempted this. It took me a while to find the answer, but it isn't possible. Some answers will advise you to modify the Activity History related list. This can be done but there will be 2 Send an Email buttons on you Case record with 2 different functionalities. You can remove the Emails related list altogether in favor of keeping only the Send an Email button on the Activity History related list, but be warned this removes all inbound emails from the record.
Attribution to: Kanova Mitchell
Possible Suggestion/Solution #5
Wont work in Summer '14 release since the 'showHTML' feature has been disabled for HTMLarea component types for Homepage layouts
Attribution to: Mark Hartnady
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1188