I have a Visualforce (child page) stored within a Standard Page layout (Opportunity parent standard page) which calls a custom controller "Save" method.
I would like for the parent page to refresh/reload automatically after the "Save" Command button is clicked on the child VF page. Is this possible?
Visualforce:
<apex:commandButton value="Save" action="{!saveConditions}" disabled="
{!if((Opportunity.ApprovalStatus__c ='' || Opportunity.ApprovalStatus__c
='Recalled' || Opportunity.ApprovalStatus__c ='Rejected') ,'false','true')}"
rendered="{!Conditions.size>0}" status="actStatusId" reRender="pgBlckId" />
Controller (saveConditions) method:
public pageReference saveConditions(){
try {
List<Pricing_Condition__c> temp = new List<Pricing_Condition__c>();
for(ConditionWrapper A : Conditions) temp.add(A.Condition);
upsert temp;
//}catch(dmlException E){ ApexPages.addMessage(new
ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); }
} catch (DMLException ex){
String errorMessage = ex.getMessage();
Integer occurence;
if (ex.getMessage().contains('FIELD_CUSTOM_VALIDATION_EXCEPTION')){
occurence = errorMessage.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION,') +
34;
errorMessage = errorMessage.mid(occurence, errorMessage.length());
occurence = errorMessage.lastIndexOf(':');
errorMessage = errorMessage.mid(0, occurence);
}
else {
errorMessage = ex.getMessage();
}
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,
errorMessage));
}
return null;
}