I am having issues understanding how to pass the {!Case.Id} value to a PageReference in a visualforce class.

My VF Page is:

<apex:page standardController="Case" extensions="escalateToJiraController" >

<apex:form >
    <apex:pageBlock title="Escalate Case" mode="edit">

        <apex:PageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"/>
            <apex:commandButton value="Cancel" action="{!cancel}" onclick="window.close()"/>

        <apex:pageBlockSection columns="1">
                <apex:outputField value="{!Case.CaseNumber}"/>
                <apex:inputField value="{!Case.Escalation_Priority__c}"/>                    
                <apex:inputField style="width: 500px" value="{!Case.Escalation_Subject__c}"/>

                <apex:outputText label="Instructions" escape="false" value="
                   Please provide a complete problem description. Provide all relevant information including hostnames"/>
                <apex:outputText label=" " escape="false" value="
                   and specific times for each relevant event. Below that, please paste, and complete, the appropriate"/> 
                <apex:outputText label=" " escape="false" value="
                   Escalation Template from the CS Debugging Guide."/>                                    

                <apex:inputField style="width: 500px; height: 500px" value="{!Case.Escalation_Description__c}"/>



My Controller:

    public class escalateToJiraController {

    ApexPages.StandardController controller;

    public escalateToJiraController(ApexPages.StandardController con){
        controller = con;

    public PageReference save() {
        PageReference pageRef = new PageReference('http://somewebsite.com/sfdc/jira-test.php?token=8675309&case={!Case.Id}');
        return pageRef;


I think I need to use getParameters(), but am not really finding examples that I am able to make much sense of. Pretty new at the VF/Apex stuff.

Any tips appreciated!


You have to add the parameter explicitly. My favorite way to do this is using getParameters:

Pagereference ref = new Pagereference('http://somesite...');
return ref;
  • This was the easiest way to accomplish my goal. Thank you!!! – AaronC Oct 6 '14 at 19:05

You can add querystring parameters to the page reference by using [MY PAGEREF].getParameters().put(key, value)

Case myCase { get; set; }

public escalateToJiraController(ApexPages.StandardController con){
    controller = con;
    myCase = (Case)con.getRecord();

public PageReference save() {
    PageReference pageRef = new PageReference('http://somewebsite.com/sfdc/jira-test.php');
    return pageRef;

  • This was good - but I like the short had way for this particular problem (see answer). Thanks! – AaronC Oct 6 '14 at 19:07

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.