Fer
Fer

Reputation: 4196

How to implement cross app navigation and navigating back to the Fiori launchpad home?

In our company, we've set up the Fiori launchpad. In it, we have configured a tile that is linked to a custom developed SAPUI5 app, which is deployed as a BSP on the server. It took us a long while, yet using the router pattern within that application, we managed to make the navigation from the launchpad tile to the custom UI5 application work.

The thing we are struggling with, however, are these 2 other navigation paths:

Ideally, this out of application navigation is in the UI5 way, including a transition, so not just a window.replace in JS. After a long search, the only hint I've found in support for this scenario is in this class:

https://ui5.sap.com/#/api/sap.ushell.services.CrossApplicationNavigation

However, I don't understand how to use it. The example isn't even correct and has syntax errors. I've found two forum posts elsewhere asking about how to use it, but they lack any meaningful answer.

Upvotes: 2

Views: 11577

Answers (1)

Tim Gerlach
Tim Gerlach

Reputation: 3390

Assuming you are using Semantic Objects for in-place navigation configured in your Launchpad to navigate to UI5 Applications you can navigate from one Application to another using the CrossApplicationNavigation service you already mentioned. However, the documentation about it is slightly confusing. This is how it works for me:

// Step 1: Get Service for app to app navigation
var navigationService = sap.ushell.Container.getService("CrossApplicationNavigation");

// Step 2: Navigate using your semantic object
navigationService.toExternal({ 
                               target : { semanticObject : "<YourObject>", action: "<YourAction>" },
                               params : { A : "B" } // optionally
                            })

If you want to go back to your launchpad after in-place navigation you simply need to call

window.history.go(-1)

This still triggers the correct transition.

Upvotes: 2

Related Questions