title: add a button sapui5 javascript
body: <p>New to sapui5, and I'm trying to make a change to an existing development and add another button to this UI.</p>
  
  <p>Here is my coding, I am trying to add oAssetBtn2 to the UI, the other button already works??</p>
  
  <p>Currently, I am getting the error:
  AppController.js:2283 Custom code error: Error: adding element with duplicate id 'assetBtn-Custom2'
  Error: Error: adding element with duplicate id 'assetBtn-Custom2'</p>
  
  <pre><code>       ASSETCREATE = function() {
         var oAssetBtn2  = sap.ui.getCore().byId('assetBtn-Custom2');
         };
  
        ASSETCREATE.prototype.CUSTOM_POST_EXIT = function(methodName, view, 
        controller,methodSignature, dialog) {
          if (view == 'accountLineDetails') {
             sap.ui.getCore().byId('CategoryListDetAS').setProperty('enabled',false);
         this.accounting = 
         sap.ui.getCore().byId("accAssignment").getController().accounting;
         var oFormModel = this.accounting.callMethod("_getFormModel");
         var oModel = oFormModel.oData ;
      jQuery.sap.require("sap.ui.commons.MessageBox");
      var oBtnLayout  = 
      sap.ui.getCore().byId(sap.ui.getCore().byId('saveBtn').getParent().getId());
      var oAssetBtn   = sap.ui.getCore().byId('assetBtn-Custom');
      // Add the "Create Multiple Asset" button in the footer layout
      jQuery.sap.require("sap.ui.commons.MessageBox");
      var oBtnLayout2 = 
    sap.ui.getCore().byId(sap.ui.getCore().byId('cancelBtn').getParent().getId());
      var oAssetBtn2  = sap.ui.getCore().byId('assetBtn-Custom2');
          &lt;%
          data: lv_langu type sy-langu.
    lv_langu = sy-langu.
  %&gt;
      var lv_language = "" ;
      var lv_text = "";
      var lv_multiple_txt = "";
      if( lv_language == "F" ){
         lv_text = "Créer Immo";
         lv_multiple_txt = "Créer Plusieurs Actifs";
        }
        else{
         lv_text = "Create Asset";
         lv_multiple_txt = "Create Multiple Assets";
        }
          var oAssetBtn2 = new sap.ui.commons.Button({
          id   : "assetBtn-Custom2",
          text : lv_multiple_txt,
          tooltip : Appcc.getText("Create many Assets")
          });
      if (!oAssetBtn) {
          var oAssetBtn = new sap.ui.commons.Button({
          id   : "assetBtn-Custom",
          text : lv_text,
          tooltip : Appcc.getText("Creates an Asset")
        });
  </code></pre>
  
  <p>thanks fellow coders!</p>
  
  <p>View of the error in Chrome:
  <a href="https://i.stack.imgur.com/qrsiG.jpg" rel="nofollow noreferrer">err</a></p>