我的要求是-
Create
带有按钮的应用程序show data
。>我的解决方案是从源应用程序
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。但是我无法更新我的主应用程序...
似乎先前的评论已删除,所以lemme再次回答您的问题。