1
我建設具有以下數據模型文檔管理應用程序:設置/修改紀錄協會與客戶端腳本
- Doc_Metadata - Approval_Requests - WorkflowStage - 審批 - 評
我試圖使用文檔審批工作流模板作爲起點,並將Doc_Metadata父項與「請求」模型相關聯,以便每個審批請求都與(擁有b y)父元數據記錄。
我已經得到它的工作從開始到結束沒有拋出任何錯誤,但無論我做什麼我都無法獲得元數據 - 請求關係來保存。
我已經爲下面的添加請求頁面發佈了我的客戶端腳本,並且還附加了我的應用程序的zip,以防有人想要查看更多細節。
任何和所有的建議都令人難以置信的讚賞,我喜歡appmaker的想法,但一直在努力理解關係與他們傳統上在SQL中如何處理。
/**
* @fileoverview Client script functions for AddRequest page.
*/
/**
* Navigates user to the add request page and sets page URL parameters.
* @param {string=} metadataKey - optional metadata with this key will be used
* as default for the new approval request.
*/
function gotoAddRequestPage(metadataKey) {
var params = {
metadataKey: metadataKey
};
// DEBUG
console.log(params.metadataKey);
console.log(metadataKey);
gotoPage(app.pages.AddRequest, params);
}
/**
* Creates a new request and redirects user to the edit screen afterwards.
* @param {Widget} submitButton - button that triggers the action.
*/
function createRequest(submitButton) {
var addRequestPage = submitButton.root;
if (addRequestPage.validate()) {
submitButton.enabled = false;
submitButton.datasource.saveChanges({
success: function() {
submitButton.enabled = true;
//DEBUG
console.log("requestId:" + submitButton.datasource.item._key);
goToRequestDetailsPage(submitButton.datasource.item._key);
},
failure: function(error) {
submitButton.enabled = true;
}
});
}
}
/**
* Creates a new request and redirects user to the edit screen afterwards.
* @param {Widget} cancelButton - button that triggers the action.
*/
function cancelCreateRequest(cancelButton) {
cancelButton.datasource.clearChanges();
app.showPage(app.pages.Main);
}
function onRequestCreate() {
google.script.url.getLocation(function(location) {
var metadataKey = location.parameter.metadataKey;
var props = {
metadataKey: metadataKey
};
var allMetadataDs = app.datasources.AllMetadata;
var metadataDs = allMetadataDs.item;
var requestDs = app.datasources.RequestsByKey;
//DERBUG//
console.log("metadataKey: " + metadataKey);
var newRequest = requestDs.createItem();
newRequest.Metadata = metadataDs;
var requests = metadataDs.Request;
requests.push(newRequest);
});
}