You need to sign in to do that
Don't have an account?
Anupama Jante
pageReference.setRedirect() is not working in lightning
Hi Folks,
I have a opportunity quick action to open VF page in lightning. The controller is updating the record but the update is not reflecting on the record detail page i.e. the detail is not getting refreshed through below.
PageReference pg = new PageReference('/'+Opp.Id);
pg.setRedirect(true);
return pg;
The above code refreshes the detail page in classic but not in lightning.
I have also tried with adding the oncomplete attribute to button i.e. oncomplete="window.opener.location.refresh();" but no luck
Please help me to achieve detail page refresh through VF/apex in lighting.
Thanks,
Anupama
I have a opportunity quick action to open VF page in lightning. The controller is updating the record but the update is not reflecting on the record detail page i.e. the detail is not getting refreshed through below.
PageReference pg = new PageReference('/'+Opp.Id);
pg.setRedirect(true);
return pg;
The above code refreshes the detail page in classic but not in lightning.
I have also tried with adding the oncomplete attribute to button i.e. oncomplete="window.opener.location.refresh();" but no luck
Please help me to achieve detail page refresh through VF/apex in lighting.
Thanks,
Anupama
Greetings to you!
I tried to research your problem and found some solution which might help you.
If you want to use your page in lightning only then you can use:
However, if you want to use your page in both classic and lightning then you can use getUiThemeDisplayed ()
These are the values:
Theme1—Obsolete Salesforce theme
Theme2—Salesforce Classic 2005 user interface theme
Theme3—Salesforce Classic 2010 user interface theme
Theme4d—Modern “Lightning Experience” Salesforce theme
Theme4t—Salesforce mobile app theme
Theme4u—Lightning Console theme
PortalDefault—Salesforce Customer Portal theme
Webstore—Salesforce AppExchange theme
So, you have to use if condition like this:
Also, there is a known issue: Visualforce Page reference id not working on Lightning.
Please refer to the below link for more information.
https://success.salesforce.com/issues_view?id=a1p3A0000001BrUQAU&title=visualforce-page-reference-id-not-working-on-lightning
And there is no workaround available. But it is in a review and we may get a solution for this soon.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
I have also tried calling js function with below code onComplete action and still no luck.
- sforce.one.navigateToURL('one/one.app#/sObject/'+oppId);
- window.open(window.location.origin+'/'+'/one/one.app#/sObject/'+oppId+'/view','_parent');
However, redirect is happening but the updated oppty record is not showing up. Its just displaying the older version of the record .
Thanks,
Anupama