skip to Main Content

I have both my apps in the FLP. At present I am sending only limited data so I am able to send it by appending it to URL. I would like to change this and send an array. I tried using AppState but it does not seem to work and I could not find an example with the new UI5 version (1.120.9) Could someone please help me with this?
Thank you!

 Container.getServiceAsync("Navigation").then((oCrossAppNavigator) => {
 oCrossAppNavigator.getHref({
 target: { shellHash: 'xyz + plant=$plant' + material + ... }
 }).then((hash) => { if (navigationOption === "newTab") {
 let URLHelper = library.URLHelper;
  URLHelper.redirect(hash, true); }
  else {
oCrossAppNavigator.navigate({
 target: {shellHash: hash}
 });

My current implementation is above.

This is what I tried

sap.ushell.Container.getServiceAsync("CrossApplicationNavigation").then((oCrossAppNav) => {
                const oAppState = oCrossAppNav.createEmptyAppStateAsync(this);
                oAppState.setData(arrayData);
                oAppState.save();
oCrossAppNav.getHrefForAppSpecificHash('xyz&sap-iapp-state=${oAppState.getKey()}')
.then((hash) => {{ if (navigationOption === "newTab") {
                            let URLHelper = library.URLHelper;
                            URLHelper.redirect(hash, true); }
                else {
                    oCrossAppNavigator.navigate({
                                target: {
                                    shellHash: hash
                                }
                            });

2

Answers


  1. Chosen as BEST ANSWER

    Added this

    localStorage.setItem("Data", JSON.stringify(Data));
    

    before Container.getServiceAsync("Navigation").then((oCrossAppNavigator) => {


  2. A URL has a length limitation, so passing an array in it is not a good option.
    You could try storing your array in the localStorage.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search