Hi All,
This blog details on Navigation from a custom card in OVP to object page of another application with parameters.
Pre-requisites:
Created an OVP app and added a custom card to it. For more details on how to create a custom card, please refer this blog.
https://blogs.sap.com/2017/05/21/create-your-own-custom-card-in-a-sap-fiori-overview-page/
I had a form in my custom card and clicking on header of the card should enable me to navigate to another app's object page.
Steps
- Create "other extensions" in OVP extension
- a custom.controller.js is craeted in ext folder of the app.
- if you had created a custom card , say inside the folder cards, you will be able to see a fragment, a controller and a component.js inside that card as shown in the image below.
- Open this component.js and remove the header and footer fragments part.It should have only the content fragment as shown below
metadata: {
properties: {
"contentFragment": {
"type": "string",
"defaultValue": "namespace.ext.cards.generalInfo"
}
},
5.Open custom.controller.js and override the doCustomNavigation method
doCustomNavigation: function (sCardId, oContext, oNavigationEntry) {
if(sCardId=="card00")
{
var id=Object.keys(oContext).id
var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation"); // get a handle on the global XAppNav service
oCrossAppNavigator.toExternal({
target : { shellHash : "app1-display&/object_page_entity_set('"+ig+"')"}
});
}
*its '"+id+"' and not '"+ig in +"'
Note: the shellhasg is ideally the URL of the app2's object page
6. Save and Run.
7. Now clicking on header of custom card will lead you to object page of app2