daredadevil February 2016

Fiori SAPUI5 - Get the complete target URL as string during Cross App Navigation

I have a use case where I have to capture the target url as a string.

I use cross App Navigation to navigate to another app.How do I build the same url that I get after the cross app navigation so that I can save it as a link that is shareable.

onNavigateToCampaign: function(event) {
    var campaignId = event.getSource().getBindingContext().getProperty("InitiativeId");
    if (jQuery.sap.getUriParameters().get("sap-hpa-shell")) {
        window.top.postMessage({
            id: "sap.hpa.shell.navigateTo",
            hash: "#INITIATIVE_TI",
            objectId: campaignId
        }, document.location.origin);
    } else {
        var fgetService = sap.ushell && sap.ushell.Container && sap.ushell.Container.getService;
        var oCrossAppNavigator = fgetService && fgetService("CrossApplicationNavigation");
        if (oCrossAppNavigator) {
            oCrossAppNavigator.toExternal({
                target: {
                    semanticObject: "Initiative",
                    action: "showDetail"
                },
                params: {
                    "id": [campaignId],
                    "sap-hpa-targetobject": ["INITIATIVE_TI"]
                }
            });
        }
    }
}

Answers


corax228 February 2016

at our system it wasnt window.location.href , it was window.location.hash to get the url parts!

Post Status

Asked in February 2016
Viewed 1,497 times
Voted 10
Answered 1 times

Search




Leave an answer