Skip to content

Instantly share code, notes, and snippets.

@Leoooob
Created March 18, 2019 13:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leoooob/d66dc83358e8bf26d68982ec167a9a6b to your computer and use it in GitHub Desktop.
Save Leoooob/d66dc83358e8bf26d68982ec167a9a6b to your computer and use it in GitHub Desktop.
SAPUI5 Fiori cross-app navigation example
//add _launchCrossApp() function to the base controller and invoke as below
const semanticObject = "MyCustomApp";
const semanticAction = "display";
let mParams = {};
mParams["myParameter"] = "myValue";
this._launchCrossApp(semanticObject, semanticAction, mParams);
// the function
_launchCrossApp: function _launchCrossApp(semanticObject, semanticAction, mParams) {
const oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
// generates a hash for the Fiori Launchpad to follow
const hash = (oCrossAppNavigator && oCrossAppNavigator.hrefForExternal({
target: {
semanticObject: semanticObject,
action: semanticAction
},
params: mParams
})) || "";
// navigates to the new hash
oCrossAppNavigator.toExternal({
target: {
shellHash: hash
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment