You need to sign in to do that
Don't have an account?
Refresh object after upsert
My Problem:
I have a public form which I want the client to fill in once. It should not be possible to call this form again after saving it.
I did a type of nice routing which uses a variable "isClientRegistered" which gets set to true hidden just before I insert the dataset. Next time you call the form, I employ an action to check if that variable is set. If so -> route to a nice page...
My VF Page header
<apex:page standardController="Client_Profile__c" extensions="VFFileUpload,ClientProfileRouting" sidebar="false" showHeader="false" action="{!redirect}">
My controller object
public class ClientProfileRouting { Client_Profile__c profile {get; set;} public ClientProfileRouting(ApexPages.StandardController controller) { profile = (Client_Profile__c) controller.getRecord(); } public PageReference save(){ profile.isClientRegistered__c = true; upsert profile; return new PageReference('/apex/ClientProfile_thankyou'); } public PageReference redirect(){ PageReference pg = null; if(profile.isClientRegistered__c == true){ pg = new PageReference('/apex/ClientProfile_alreadydone'); pg.setRedirect(true); } return pg; } }
I found, that after saving my object, it does not get refreshed when the client immediately tries to call the form again.So the flag seems to be set to false in this case. And subsequently, the client does not get routed to the narrative page "clinetProfile_aleadydone"
Question:
How do I make sure that the object gets refreshed anytime, the form is called?
check whether the cache attribute is false or not at page level. If it is true it will bring the form from user's cache.