+ Start a Discussion
AKallAKall 

Was RET URL functionality changed by Winter 09?

It seems that Winter 09 handles ret url differently. I am having trouble with the return url in two of my VF pages now that Winter 09 has gone live. Has anybody else had problems?
mtbclimbermtbclimber
Could you be more specific? Perhaps you could post your page/controller code and repro steps? Are you coming from a standard page to an overridden one? Is it a standard component like listviews that is now generating bad links in your Visualforce page? etc.
AKallAKall
After looking a little deeper it seems that the problem only happens upon saving a new record. When deleting, canceling, or editing on the same form the ret url is correct. When creating a new record the page goes to the contract product page rather than back to the xRL page. I cannot identify any difference between the 'Save New' button and any of the other buttons. In addition, the 'Save Changes', which also calls the {!Save} method works fine, so it must have to do with creating a new record. I have posted the code so that you can have a look.

xRLContractProduct
Code:
<apex:page standardController="ContractPlus__c" showHeader="False">
<apex:form >

 <apex:pageBlock >
     <table width="100%">
       <tr>
          <td style='font-weight:bold'>Total Product Value</td><td width="20%"><apex:outputField value="{!ContractPlus__c.TotalProductValue__c}" /></td>
          <td style='font-weight:bold'>Product Summary</td><td width="20%"><apex:outputField value="{!ContractPlus__c.ProductSummary__c}" /></td>
       </tr>
     </table>
   <apex:pageBlockSection title="Contract Products" id="ConProdList" >
      <apex:pageBlockTable value="{!ContractPlus__c.ContractProducts__r}" var="c">
      <apex:facet name="caption" >
          <c:btnGoToPage xID="newbtn" ButtonLabel="New Product" TargetPage="/apex/xRDContractProduct" QSParameters="mode=new&Contract={!ContractPlus__c.id}" ReturnURL="/apex/xRLContractProduct—id={!ContractPlus__c.id}" />
      </apex:facet>
        <apex:column >
           <apex:outputpanel >
            <c:btnGoToPage xID="edit{!c.ID}" ButtonLabel="Edit" TargetPage="/apex/xRDContractProduct" QSParameters="id={!c.id}&mode=edit" ReturnURL="/apex/xRLContractProduct–id={!ContractPlus__c.id}" />
            </apex:outputPanel>
        </apex:column>
        <apex:column >
            <apex:outputPanel >

            <c:btnGoToPage xID="del{!c.ID}" ButtonLabel="Delete" TargetPage="/apex/xRDContractProduct" QSParameters="id={!c.id}&mode=delete" ReturnURL="/apex/xRLContractProduct˜id={!ContractPlus__c.id}" />
            </apex:outputPanel>
        </apex:column>
        <apex:column headerValue="Product Type................" style="text-align:left">{!c.lc_Product__r.ProductType__r.Name}</apex:column>
        <apex:column headerValue="Product Name..............................." value="{!c.lc_Product__r.Name}" style="text-align:left" />
        <apex:column headerValue="Product Code...." value="{!c.lc_Product__r.Product_Code__c}" style="text-align:right" />
        <apex:column headerValue="Price Before Discount">
                <apex:outputField value="{!c.Amount__c}"  styleClass="CurrencyElement" />
                </apex:column> 
          </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 xRDContractProduct
Code:
<apex:page standardController="ContractProduct__c" extensions="ContractProduct_controller" showHeader="false" sidebar="false" tabStyle="ContractPlus__c">
<apex:form >
<apex:pageBlock mode="{!$CurrentPage.parameters.mode}" rendered="{!($CurrentPage.parameters.mode='edit')}" >
<apex:pageBlockTable value="{!ContractProduct__c}" var="op">
<apex:facet name="caption">
<apex:outputText value="{!ContractProduct__c.lc_Product__r.Name} for {!ContractProduct__c.Contract__r.Name}" />
</apex:facet>
<apex:column >
<b><apex:outputLabel value="Price Before Discount" /></b>
</apex:column>
<apex:column >
<apex:inputField value="{!ContractProduct__c.Amount__c}" />
</apex:column>
<apex:column >
<apex:commandButton action="{!save}" value="Save Changes" styleClass="btn" />
<apex:commandButton action="{!cancel}" value="Cancel" styleClass="btn" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<apex:form >
<apex:pageBlock mode="edit" rendered="{!($CurrentPage.parameters.mode='new')}" Title="Create New Product">
<apex:messages />
<apex:pageBlockTable value="{!ContractProduct__c}" var="op">
<apex:param assignTo="{!ContractProduct__c.Contract__c}" value="{!$CurrentPage.parameters.contract}" />
<apex:column >
<b><apex:outputLabel value="Product"/> </b>
</apex:column>
<apex:column >
<apex:inputField value="{!ContractProduct__c.Contract__c}" rendered="{!Con==''}" />
<apex:inputHidden value="{!ContractProduct__c.Contract__c}" rendered="{!ContractProduct__c.Contract__c<>''}" />
<b><apex:inputField value="{!ContractProduct__c.lc_Product__c}"/></b>
</apex:column>
<apex:column >
<b><apex:outputLabel value="Price Before Discount" /></b>
</apex:column>
<apex:column >
<apex:inputText value="{!ContractProduct__c.Amount__c}" />
</apex:column>
<apex:column >
<apex:commandButton action="{!save}" value="Save New" styleClass="btn"/>
<apex:commandButton action="{!cancel}" value="Cancel" styleClass="btn" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<apex:form >
<apex:pageBlock mode="{!$CurrentPage.parameters.mode}" rendered="{!($CurrentPage.parameters.mode='delete')}">
You have requested to delete this product - {!ContractProduct__c.lc_Product__r.Name} from this Contract<br />
<apex:commandButton action="{!delete}" value="Confirm Delete" styleClass="btn" />
<apex:commandButton action="{!cancel}" value="Cancel" styleClass="btn" />
</apex:pageBlock>
</apex:form>
</apex:page>

 



Code:
public class ContractProduct_controller {

    public ContractProduct_controller(ApexPages.StandardController controller){
        this.CProd = (ContractProduct__c)controller.getRecord();
    }

    /* for spring 08 testing and rollout */
    public ContractProduct_controller(){
        this.CProd = new ContractProduct__c();
    }
    
    public final ContractProduct__c CProd;
    public Boolean ConSet = false;
    public Boolean SetConSuccess = false;
    
    public ContractProduct__c getCProd(){
        return this.CProd;
    }
    
    public void setCon(){
     try{
      this.SetConSuccess = this.setConInner();
     }
      catch(exception e){
      System.debug('Failed to set contract: '+ e);
     }
    }
    
    public boolean setConInner(){
        /* returned boolean can be used to control rendering of form */
        // summer 08 // String mode = ApexPage.currentPage().getParameters().get('mode');
        String mode = System.currentPageReference().getParameters().get('mode');
        this.ConSet = true;
        
        if (this.CProd.Contract__c != null){
           return true;
           
        } else if (mode=='new'){
            // summer 08 // this.OP.Contract__c = ApexPage.currentPage().getParameters().get('contract');
            if (System.currentPageReference().getParameters().get('contract')!=null){
                this.CProd.Contract__c = System.currentPageReference().getParameters().get('contract');
                System.debug(this.CProd.Contract__c);
                return true;
               
            } else {
                System.debug('Required querystring parameter \'contract\' was not received');
                return false;
                
            }
                        
        } else {
           System.debug('Required querystring parameter \'mode\' was not new');
           return false;   
        }
        
    }
    
    public ID getCon(){
        if (!this.ConSet){
            this.setCon();
        }
        return this.CProd.Contract__c;
    }

}