You need to sign in to do that
Don't have an account?
Jean Grey 10
Rerender original page after creating record
I have a vf page with extension that creates some records on a custom object related to OpportunityLineItem. I need the page to close after the records are created, and then refresh the original OLI page to show the new record in the related list. I tried this but it doesn't refresh the page:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<apex:actionFunction name="Rerender()" rerender="true" />
<script> function Return() {
window.close();
Rerender();
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
So I have this but it just returns the original page in my new window, if the user does this a few times they will end up with way too many windows open:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<script> function Return() {
window.location.href = 'https://cs63.salesforce.com/'+'{!OpportunityLineItem.ID}'
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<apex:actionFunction name="Rerender()" rerender="true" />
<script> function Return() {
window.close();
Rerender();
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
So I have this but it just returns the original page in my new window, if the user does this a few times they will end up with way too many windows open:
<apex:page standardController="OpportunityLineItem" extensions="ScheduleExtension" docType="html-5.0">
<apex:form>
<script> function Return() {
window.location.href = 'https://cs63.salesforce.com/'+'{!OpportunityLineItem.ID}'
}
</script>
<apex:pageBlock title="Set Product Schedule for {!OpportunityLineItem.Name}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!gensched}" value="Generate Schedule" rendered="{!OpportunityLineItem.Schedule__c == null}" oncomplete="Return()" />
</apex:pageBlockButtons>
All Answers
https://developer.salesforce.com/forums/?id=906F0000000AUbpIAG