0

I need to add a button to a Case, its called EI_Case_View; this is the javascript that the button I need added to the Visualforce page:

var splitHost = location.host.split('.');
var baseURL;
if(splitHost[0] == 'c') {
baseURL = 'https://' + splitHost[1] + ".salesforce.com";
} else {
baseURL = 'https://' + splitHost[0] + ".salesforce.com"
}
location = baseURL + '/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&p26=provisioning@virtual1.com:Virtual1%20Provisioning&p6=Case%20{!Case.CaseNumber}%20 / {!URLENCODE(Case.Access_ID__c)}%20 / {!URLENCODE(Case.End_Customer_Name__c)}%20 / {!URLENCODE(Case.Site_Name_B_End__c)}%20 / {!URLENCODE( Case.Partner_Internal_Ref__c )}&template_id=00X30000001Wctm&p5=';

EDIT:

So this is what I have so far:

visual force page code: <apex:commandButton value="Email Partner (From Prov)" onclick ="($Action.Case.Email_Partner_From_Prov)" />

I added the script on the page also, including in the script tags.

<script>
var splitHost = location.host.split('.');
        var baseURL;
        if(splitHost[0] == 'c') {
            baseURL = 'https://' + splitHost[1] + ".salesforce.com";
        } else {
            baseURL = 'https://' + splitHost[0] + ".salesforce.com"
        }
        location = baseURL + '/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&p26=provisioning@virtual1.com:Virtual1%20Provisioning&p6=Case%20{!Case.CaseNumber}%20 / {!URLENCODE(Case.Access_ID__c)}%20 / {!URLENCODE(Case.End_Customer_Name__c)}%20 / {!URLENCODE(Case.Site_Name_B_End__c)}%20 / {!URLENCODE( Case.Partner_Internal_Ref__c )}&template_id=00X30000001Wctm&p5=';


    }
    </script>
  • Hello and welcome! can you maybe add a little more information? Does your new button need to be on the Case Page Layout? Is it a custom visualforce thing you are building? Are overrrides involved? – Christian Szandor Knapp Feb 12 at 12:06
  • My apologies for being so vague, so the button already exists however we want to add it to a custom visualforce page, what happens when the script is executed is that it will redirect you to an email page and auto populate a few fields but that doesn't matter. I'll add the extra info to the question for you. – Harry Smith Feb 12 at 13:10
1

You seem to need a basic html/jasvascript button.

<apex:page >

    <script type="text/javascript">
    function clicked() {
        window.location.href = 'https://www.google.com';
    }

    </script>


    <input type="button" onclick="clicked();" value="clickMe" name="click"/>

</apex:page>
  • Danke mein freund, das ist perfekt! – Harry Smith Feb 12 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.