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}&[email protected]: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}&[email protected]: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>
2
  • 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? Commented Feb 12, 2019 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. Commented Feb 12, 2019 at 13:10

1 Answer 1

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>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .