You need to sign in to do that
Don't have an account?
Tim Miller 26
Redirecting from a lightning app back to a tab default view for a Lead or contact
I have a lightning app that when the cancel button is pressed, I try to redirect to a tab default view for the Lead object or Contact object it opens up a lightning page inside a lightning page.
Here is my code for the cancel button event:
cancelEvent : function(component, event, helper) {
var address = 'https://rv--timdev.lightning.force.com/one/one.app#/sObject/Lead/list?filterName=Recent';
window.location.href = address;
}
I have tired using force:navigateToURL and force:navigateToObject and never can get those to work. here is my example:
cancelEvent : function(component, event, helper) {
var address = 'https://rv--dev.lightning.force.com/one/one.app#/sObject/Lead/list?filterName=Recent';
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": address
});
urlEvent.fire();
}
Here is my code for the cancel button event:
cancelEvent : function(component, event, helper) {
var address = 'https://rv--timdev.lightning.force.com/one/one.app#/sObject/Lead/list?filterName=Recent';
window.location.href = address;
}
I have tired using force:navigateToURL and force:navigateToObject and never can get those to work. here is my example:
cancelEvent : function(component, event, helper) {
var address = 'https://rv--dev.lightning.force.com/one/one.app#/sObject/Lead/list?filterName=Recent';
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": address
});
urlEvent.fire();
}
- why do I get the lightning window in the lightning window? is it due to lightnings iframe?
- why doesn't the navigateToURL work?
if((typeof sforce != 'undefined') && sforce && (!!sforce.one))
sforce.one.navigateToSObject(account.Id);
else
window.location = "/"+account.Id;
If this resolves your issue please mark as best answer.