You need to sign in to do that
Don't have an account?
How to check user page whether it is opened from salesforce classic or Lightning App UI. ?
Hello All,
I'm stuck in the middle of this problem I don't know how check from which source user page extrated. If I open user page first in salesforce classic and after I switch it to Lightning.
Thanks to all of you in advance
Regards'
Taresh Pandey
I'm stuck in the middle of this problem I don't know how check from which source user page extrated. If I open user page first in salesforce classic and after I switch it to Lightning.
Thanks to all of you in advance
Regards'
Taresh Pandey
All Answers
You can check this with simple Javascript code on your page:
and the use this function in next way: You can find more infromation in related Trailhead module: Sharing Visualforce Pages Between Classic and Lightning Experience (https://developer.salesforce.com/trailhead/lex_dev_visualforce/lex_dev_visualforce_multipurpose_pages)
Vladimir Gergiev
This code might help me but I need pure apex hand for the remote calling. Do you have any other solution for the issue; in Apex.
public static Boolean isSalesForce1orLE() {
if(ApexPages.currentPage().getParameters().get('sfdcIFrameHost') != null ||
ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin') != null ||
ApexPages.currentPage().getParameters().get('isdtp') == 'p1') {
return true;
}
else {
return false;
}
}
if((typeof sforce != 'undefined') && sforce && (!!sforce.one))
sforce.one.navigateToSObject(account.Id);
else
window.location = "/"+account.Id;
this code is chceking if you are in lightning experience then going through container one app else simply doing window.location.
if(document.referrer.indexOf(".lightning.force.com") > 0){
alert("welcome to lightning ");
}else{
alert("welcome to classic");
}
I want to return to the record page from where the flow was called (in the same window/tab, we don't want a new window to be opened).
My VF page looks like this:
I've also tried using sforce.one.navigateToURL("/"+myfield__c.Id); and window.location.assign = "/"+{!myfield__c.Id}; with no success.
As I'm already using a standard controller, I can't use a controller to redirect to the record page. So, I'm using an extension which calls to my javascript code. If we are in SF1 then, sforce.one should fire. If we are in classic then, window.location should fire.
The extension code is:
But I get this invalid redirection message:
Invalid Page Redirection
The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance. For more information, see Insufficient Privileges Errors.
Click here to return to the previous page.
Thanks for your help!
Miriam
You can use this sample code:
It returns theme (Classic/Lightning) or it is displayed as mobile app. See in documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_userinfo.htm