私はApp Makerにとってかなり新しいです。私はユーザーが完了したフォームをCreditApplicationと呼んでいます(リンクされたデータソースはCreditApplicationとも呼ばれます)。
このフォームには[送信]ボタンがあります。提出すると、完了したレコードへのリンクを含むメールが別のユーザーに電子メールで送信されます。完成したフォームでレコードへのリンクを作成する
このリンクの作成に問題があります。私は、電子メールのユーザーをCreditApplicationフォームの同じレコードにリンクさせたいと思います。 私は以下に挙げたものを挙げました。
CreditApplicationフォームは、onClickのがに設定されてが [送信]ボタンを持っている:
createRequest(widget).
CreditApplicationのデータソースがあるのonCreateイベントに以下のコード:
var to = "[email protected]";
var subject = "New Online Credit Application Submission - " + record.FirstName + " (Sales Contact: " + record.SalesContact + ")";
var msg = "A credit application has been submitted for " + record.FirstName + "." + "<br><br>";
var appUrl = ScriptApp.getService().getUrl() + '#CreditApplication?requestId=' + record._key;
msg = msg + appUrl;
MailApp.sendEmail(to, subject, msg, {htmlBody: msg});
クライアントのJavaScriptコードがClientScというライブラリにあります次のように表示されます。
/**
* Replaces the url history state to reflect the changes upon navigation
* from a different screen.
* @param {String} requestId - id of the selected request.
*/
function replaceUrlForReadRequest(requestId) {
var params = {
requestId: requestId
};
google.script.history.replace(null, params, app.pages.NewPage1.name);
}
/**
* Replaces the url history state to reflect the changes upon navigation
* from a different screen.
* @param {Page} page - application page to navigate.
*/
function replaceUrlForPage(page) {
var params = {};
google.script.history.replace(null, params, page.name);
}
/**
* Creates a new request and redirects user to the read screen afterwards.
* @param {Widget} submitButton - button that triggers the action.
*/
function createRequest(submitButton) {
if (!submitButton.root.validate()) {
return;
}
var NewPage1 = app.pages.NewPage1;
submitButton.datasource.createItem(function(record) {
if (app.currentPage === NewPage1) {
replaceUrlForReadRequest(record._key);
}
});
app.showPage(NewPage1);
replaceUrlForPage(NewPage1);
}