I have an inline visualforce page on Case layout. When the case page is loaded, this loads the vf page and there is an action call on the inline vf.
<apex:page name="xyz" standardController="Case" extensions="xyzcallout" action="{!WebServiceMethod}">
The WebServiceMethod method is a callout to external application. Based on the values coming in from the callout Case.Status is updated.
if(field_name == 'Defined'){
cas.Status = 'Approved';
System.debug(cas.Status);
update cas;
}
However, the Case layout doesn't show the update until the second refresh. On page load case still shows old status while inline VF page shows new status. On refresh, Case Status shows new value.
<script>
function refreshPage(){
window.top.location="/{!Case.id}";
return false;
}
window.onload = setTimeout(function(){refreshPage()},2000);
</script>
I tried using the above javascript to reload page on completion of action but it doesn't seem to work for me.
My Question: Is there a way to update the Case field after inline VF load action without a button click or any user action.
Boolean
property that tells you iffield_name == Defined' && cas.Status != 'Approved'
.