You need to sign in to do that
Don't have an account?
Staci
custom button to call VF Page
I have a reject button that I want to call a VF Page when certain criteria are met, Everything works fine BUT when you click Save, a new change record ends up being created and thats the page you return to. I just want the page to save the info you just enetered and return to the same record.
Here's the code right now in the button
window.location='/apex/rejectChangeChgMgr';
VF Page
<apex:page standardController="Change__c" extensions="rejectChange"> <apex:form id="frm"> <apex:detail subject="{!Change__c.Id}" relatedList="false" title="false"/> <apex:outputPanel id="tstpopup" rendered="{!IF(isDisplayPopUp ==true,true,false)}" > <apex:outputPanel styleClass="popupBackground" layout="block" /> <apex:outputPanel styleClass="custPopup" layout="block"> <apex:pageMessages > </apex:pageMessages> <apex:pageBlock > <apex:pageBlockSection columns="1" > <apex:inputField label="Change Manager Rejected Comments" value="{!Change__c.Change_Manager_Approver_Rejected_Comment__c}" required="true" style="width: 500px"/> <apex:outputPanel > <apex:CommandButton action="{!save}" value="Save!"/> <apex:CommandButton action="{!cancel}" value="cancel"/> </apex:outputPanel> </apex:pageBlockSection> </apex:pageBlock> </apex:outputPanel> </apex:outputPanel> </apex:form> <style type="text/css"> .errorMsg{ width:159px; } .custPopup{ background-color: white; border-width: 3px; border-style: solid; z-index: 9999; left: 25%; padding:10px; position: absolute; width: 1000px; //margin-left: -80px; top:100px; margin-left: -170px; //top:305px; border-radius: 5px; } .datePicker{z-index:10000} .popupBackground{ background-color:black; opacity: 0.20; filter: alpha(opacity = 20); position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 997 } a.actionlink:hover{ text-decoration:underline; } .customactionLink { color: #015BA7; font-weight: normal; text-decoration: none; } </style> <script> function setFocusOnLoad() { } </script> </apex:page>
Class
public class rejectChange { public Boolean isDisplayPopUp {get; set;} public rejectChange(ApexPages.StandardController controller) { isDisplayPopUp = true; }}
What am I doing wrong?
window.parent.location='/apex/rejectChangeDealer?Id={!Change__c.Id}&retURL=/{!Change__c.Id}';
Try above.
All Answers
Pass record id with the URL
window.location='/apex/rejectChangeChgMgr?id=23984reihfjdehfjdhf';
Still not working. Its still opening a new record and saving the changes in there instead of the existing record and then returning to that new record. I've changed it to this:
window.parent.location='/apex/rejectChangeDealer?Id={!Change__c.Id}&retURL=/{!Change__c.Id}';
Try above.