I have a page that shows records for an object and I need to be able to select some, and then once the "Add Packages" button is clicked I need the page to return to the previous page after completing it's function in Apex.
I attempted to try getting the retURL but getting that doesn't seem to be working.
I also tried to use the standardController.cancel(); page reference but that doesn't seem to work due to the rerender on the button, which needs to be there to pass the variable.
Does anyone have any suggestions on this?
Visualforce:
<apex:page standardController="Opportunity_Package__c" extensions="MetadataPackageEditor" sidebar="false" showHeader="false">
<apex:outputPanel id="all">
<apex:form >
<apex:outputField value="{!Opportunity_Package__c.Opp_Package_Rel__c}"/>
<apex:pageBlock title="Select Package(s)">
<apex:pageMessages />
<apex:pageBlockTable value="{!packages}" var="o" id="table">
<apex:column title="Select" headerValue="Select">
<apex:inputCheckbox value="{!o.selected}"/>
</apex:column>
<apex:column value="{!o.pack.Name}"/>
<apex:column value="{!o.pack.Products__c}"/>
<apex:column value="{!o.pack.PPU_Discount__c}" headerValue="Price per Unit Discount"/>
</apex:pageBlockTable>
<apex:commandButton value="Add Packages" action="{!processAndAddSelected}" rerender="all">
<apex:param name="oppIdParam" value="{!Opportunity_Package__c.Opp_Package_Rel__c}" assignTo="{!oppId}"/>
</apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel"/>
</apex:pageBlock>
</apex:form>
</apex:outputPanel>
</apex:page>
retUrl
?