我如何从另一个App Kintone复制数据?

问题描述 投票:1回答:1

我的要求是-

  1. [Create带有按钮的应用程序
  2. 单击按钮,源应用程序的show data。>
  3. 我的解决方案是从源应用程序

中的获取数据,然后POST主应用程序。但由于无法前进,因此我无法更新主应用程序。

Note: I must use JS customize.

我的代码在下面:

let copyId = 112;
let appID = kintone.app.getId();
function getCopyAppData() {
    let body = {
      "app": copyId,
      "query": kintone.app.getQuery()
    };
    return kintone.api(kintone.api.url('/k/v1/records', true), 'GET', body).then(function(resp) {return resp;})

      
 }
  function addDataToCurrentApp(data) {
    let body = {
      "app": appID,
      "records": data
    };
    return kintone.api(kintone.api.url('/k/v1/records', true), 'POST', body).then(function(resp) {
      return resp;
    })
  }
getCopyAppData().then(function(data) {
  let events = ['app.record.create.show', 'app.record.edit.show', "app.record.index.show"];
    kintone.events.on(events, function(e) {
      if (document.getElementById('addData') !== null) {
          return;
      }
      let menuButton = document.createElement("button");
          menuButton.id = "addData";
          menuButton.innerHTML = "Add data";
      kintone.app.getHeaderMenuSpaceElement().appendChild(menuButton);
      menuButton.onclick = function() {
        addDataToCurrentApp(data);
      }
    })
})

[我的要求是-使用按钮创建应用程序。单击按钮时,显示源应用程序的数据。我的解决方案是从源App获取数据,然后将其发布到主App。但是我无法更新我的主应用程序...

javascript
1个回答
0
投票

似乎先前的评论已删除,所以lemme再次回答您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.