cancel
Showing results for 
Search instead for 
Did you mean: 

Error - Adding element with duplicate id with Launching Custom UI5 app from Fiori launch Pad

Former Member

Fellow Members -  Custom UI5 application configured into the Fiori Launch Pad and able to launch successfully first time. However, when user click on "Home" button on the Custom Application to navigate back to launch pad and re-launch same application, application end up with error - "Adding element with duplicate id". Seem like some reason Controls don't get destroyed when application destroyed.

Was spent time looking into the issue and was end up with no luck.The error is simple and make sense but don't know the fix 😞

I am looking for thoughts & direction to fix the issue.

Happy Friday..

Tags edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Even I had come across same problem. I have noticed the SAPUI5 framework is not destroying the content and instances of the component container when we destroy using

UIComponent.prototype.destroy.apply(this, arguments)"

I have variant Management control on my page and destroying on its controller using this.destroy() did not destroy the variant Management control instance.

So best option what I have tried is to remove id of the view. So that framework generates id for the view each time you move away from the page and come back. Hence it resolved duplicate Id issue and I was able to navigate as many times back and fro from launchpad to app.

Note*:

If the id for the view is specified in component.js or manifest.js you need to remove it.

"targets": {

  "worklist": {

  "viewName": "Worklist",

  "viewId": "worklist",                // Remove this line in the configuration

  "viewLevel": 1

  }

  }

Answers (6)

Answers (6)

Former Member
0 Kudos

Hello,

I've been "fighting" with that same error. I'm using a Dialog to make the user "Continue" or "Cancel", and the Dialog, buttons and an input field have its own id.

So when the user take a decision the first time all was working... but not the second time.

The solution I have applied is to "destroy" the dialog once the user has clicked a button, instead of "close"... that way it seems that the Dialog is always been created each time is needed, and there's no conflict with the identifiers.

var oButton2 = new sap.m.Button("Cancel", {

   text: "Cancel",

   press: function(oEvent) {

       //sap.ui.getCore().byId("returnDialog").close();   ---> Not working

       sap.ui.getCore().byId("returnDialog").destroy(); ---> Solution

  }

});

I hope it can help some of you.

Regards,

          Juande

Former Member
0 Kudos

Hi, I've just implemented destroy method for my component and the problem is gone.

Former Member
0 Kudos

Just FYI,

I also had the same error message.

The reason was in Component name. I input company.app.Component while it should be just like company.app.

So there is no .Component in Target mapping.

Probably it can be useful for someone.

0 Kudos

I have the same proplem with VariantManagmant and local launchpad. I can launch my application from the launchpad only one time. When we backed to launchpad and try to launch it again I've got duplicate id error. This id belonged to VariantManagment control. So I try to wrap this control using HorizontalLayout. I removed id from VariantManagment and added id to HoryzontalLayout. And it helped. Try to do something in this way

Former Member
0 Kudos

I have noticed that in variant management control standard library code "oExecuteOnSelect" is not destroyed when you destroy the control. Hence we ended up in duplicate id issue.

aakash_neelaperumal2
Active Participant
0 Kudos

Not sure on about the root cause of the issue. But changing the application type from LPD_CUST to SAPUI5 in launchpad admin page should fix this.

Former Member
0 Kudos

I changed from LPD_CUST to SAPUI5 in admin, still doesn't work. This issue is reproducible from launchpad running in local tomcat also. Issue exists in UI5 versions 1.22.3 and 1.24.1

michael_speight2
Explorer
0 Kudos

Hi Aakash,

not sure exactly what you mean here. Do you mean I should use the transaction LPD_CUST to change the application type to SAPUI5?

I don't have this option in the dropdown list. I am currently using type URL.

Regards,

Mike

aakash_neelaperumal2
Active Participant
0 Kudos

Mike,

No, the change I had mentioned is to be done in the Fiori Admin page where you had created the custom catalog & groups. Here where you have the option to provide the custom UI5 application as a direct link(SAPUI5) or as LPDCUST entry.

But that is just a workaround, which fixed the same issue I had before. Its better to upgrade the UI5 libraries and also check if there are any issue in the UI5 application.

michael_speight2
Explorer
0 Kudos

Hi Aakash,

do you mean the option "Use semantic object navigation"?

Do you happen to have a screenshot for the settings that you used?

Thanks,

Mike


aakash_neelaperumal2
Active Participant
0 Kudos

Hi Mike,

I dont have access to the system right now to send a screenshot. But you should be able to find this option in Fiori Admin -> Target Mapping -> Target. In target, if you have the latest UI5 library version, then you should be getting the option to select either LPDCUST or SAPUI5 (radio button). But if you are using older library version then your only option is to use the LPDCUST.

Please make sure that you have applied all notes in below link.

aakash_neelaperumal2
Active Participant
0 Kudos

Mike,

PFA screenshot.

michael_speight2
Explorer
0 Kudos

Hi Aakash,

Thanks a lot for you efforts.

I have to use the LPD_CUST variant though, due to the way the roles are being assigned here.

It also fits in with all the other standard Fiori apps that are being used.

Like you say, that would only be a workaround anyway.

I will try to restructure the app to eliminate the problem.

Mike

cmetz
Participant
0 Kudos

I have exactly the same problem. I already changed from LPD_CUST to SAPUI5 in Fiori Admin, but still the same.

How did u solve it?

Chris

Former Member
0 Kudos

Hi Chris

The issue is not because of launchpad config.

In your application while creating UI element use createId

new sap.m.Text(this.createId("textId"),...)

and retrieve using view.byId("textId")

Regards

Vidyadhar

cmetz
Participant
0 Kudos

Thanks for your repy Vidyadhar.

I am using XML-View, so the ID creation is done automatically.... Any further ideas?

michael_speight2
Explorer
0 Kudos

Hi Christoph,

changing the code to use createId etc. did not work for me, I still got the same "duplicate ID" errors, when calling the App from the Fiori Launchpad.

What method are you using to navigate between the views?

All my problems disappeared, when I switched from the old "event-bus/navigation" model to the newer "routing" model.

I have no further duplicate ID issues, even if I use fixed IDs for some elements.

Hope this helps, as the issue is (I know) very frustrating.

Regards,

Mike

cmetz
Participant
0 Kudos

Hey Michael,

thanks for this hint. Indeed I am using event-bus navigation, so I have to change my whole navigation :-(.

I am gonna try it and give feedback.

Regards

Chris

michael_speight2
Explorer
0 Kudos

OK, good luck. It certainly worked for me.

I used the "PO approval" application in the latest version of the SDK as a reference.

Regards,

Mike

former_member187007
Active Participant
0 Kudos

Hello Christoph,

Did it work changing to route approach? or did you find another way to achieve this without changing event bus navegation?.

Best regards.

Jhon Jairo.

cmetz
Participant
0 Kudos

Hi Jhon Jario,

haven't changed the code yet. But I developed a new App with Router approach and haven't faced any duplicate id error.

Regards

Chris

former_member187007
Active Participant
0 Kudos

Hello Cristoph,

Thanks, actually I changed all my app to Router approach, and the error disappear, may be could I ask you something else, I don't want to handle bookmarking in routing so I would like to hide the hash that appears in url without changing my patterns, do you know if this can be possible?.

Thank you very much in advanced.

Best regards.

Jhon Jairo.

michael_speight2
Explorer
0 Kudos

Hi Anil,

did you manage to resolve this issue? I am having exactly the same problem.

The suggestion to not use any IDs whatsoever in the views seems like a very unsatisfactory solution to me. Sometimes I need an ID for a control!

I have also tried using createID() instead of hard-coding - same result.

I don't really undertsand why the controls are not destroyed when the application/component is closed. They just seem to hang around, or at least the name hangs around. I have had occasions where the control itself (e.g. a page) does not exist, but I still get a duplicate ID error, when I try to create it again.

Any further information you have relating to this issue would be very welcome.

Thanks & Regards,

Mike

Former Member
0 Kudos

I would need some more details from your CHROME or FF debug console. In your custom SAPUI5 app do not create the control with a specific ID and instead just leave it blank. Pls try that and let me know.

thanks

A

Former Member
0 Kudos

Thanks Ashish!! Below is the error details captured from Developer Tools of Chrome browser. I willl try out your suggestion to have a Control with blank ID and keep you posted on the result.

******************************************************************************************************************

  1. 2014-08-29 13:28:22 adding element with duplicate id 'idViewRoot--idViewMaster--itemTrips'

  1. 2014-08-29 13:28:22 Error - Error: adding element with duplicate id 'idViewRoot--idViewMaster--itemTrips'

  1. 2014-08-29 13:28:23 Failure - Unable to start App

***********************************************************************************************************************