You need to sign in to do that
Don't have an account?
Mario E
Do I need to add this line somewhere?
How to refresh the page after redirecting users at end of a Flow?
I created a VFP and Apex Controller that will run a Flow. In the flow, the Case ID will be passed through and take the user back to the same Case record after clicking a custom button.
The only issue here is that the page does not refresh to display the changes after the flow was executed.
// Redirects user to the same Case record after flow executes and reloads the page public with sharing class custom_caseJiraFlowRedirectController { public Object custom_caseJiraFlowRedirectController() { String unique_id = ApexPages.currentPage().getParameters().get('id'); if(unique_id == null){ // Return Home if no ID String url = '/home/home.jsp'; return new PageReference(url); } // Get Case ID and set Redirect String caseId = [SELECT Id, caseFlowUniqueId__c FROM Case WHERE caseFlowUniqueId__c = :unique_id ORDER BY CreatedDate DESC LIMIT 1].Id; // Did we find a Case? if (caseId == null) { // Return Home if no ID String url = '/home/home.jsp'; return new PageReference(url); } // Redirect to Case String url = '/' + caseId; return new PageReference(url); } }
Do I need to add this line somewhere?
System.PageReference setRedirect(Boolean redirect)
Please let me knoe if this works.
public PageReference newMethod() {
//Your Code here
PageReference tempPage = ApexPages.currentPage();
tempPage.setRedirect(true);
return tempPage;
}