Skip to Content
0
Apr 17, 2018 at 07:34 AM

How to navigate from Fiori apps to Launchpad Homepage?

1838 Views

Hi all,

I have a Master-detail Fiori application deployed to Fiori Launchpad. I have a home button in the master page which on clicking should navigate to Fiori Launchpad Home Page. I tried the various possible ways which was mentioned in various blog posts. Nothing worked for me. Here's the code what I have tried:

Method-1:

var oHistory = sap.ui.core.routing.History.getInstance(), 
sPreviousHash = oHistory.getPreviousHash(), 
 oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
 if (sPreviousHash !== undefined) {
	 // The history contains a previous entry 
history.go(-1);
		 } 
else {
	 // Navigate back to FLP home 
 oCrossAppNavigator.toExternal({ 
 target: { shellHash: "#" } 
 });
 }

I get 'Cannot read property getService() of undefined error'.

Method-2:

var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");  
 oCrossAppNavigator.toExternal({  
target: { semanticObject : "#"}  
 });

Method-3:

var sPreviousHash = History.getInstance().getPreviousHash(),
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
if (sPreviousHash !== undefined || !oCrossAppNavigator.isInitialNavigation()) {
history.go(-1);
} else {
oCrossAppNavigator.toExternal({
target: {shellHash: "#Shell-home"}
});
}

Can someone suggest me with this?

Regards,

Ramya