Verwenden von Google App -Skript zum Aktualisieren von Tabellenkalkulationen von Google Mail, JavaScript nicht ausgeführHTML

HTML-Programmierer
Anonymous
 Verwenden von Google App -Skript zum Aktualisieren von Tabellenkalkulationen von Google Mail, JavaScript nicht ausgeführ

Post by Anonymous »

Ich versuche, meinen Dateistatus in der Tabelle von "Past" zu "Ready" in der Tabelle zu aktualisieren, und ich möchte dies tun, indem ich den Benutzer auf ein Modal klicken kann, das über Google Mail gesendet wird, die bestätigen, dass der Status der Datei geändert wird. Ich habe etwas Konsolenprotokoll hinzugefügt, aber nichts zeigt sich (wie JavaScript überhaupt nicht ausgeführt wird), und nur
"1904984383-waren_bin_i18n_warden.js:120 Nettozustand geändert von untätig zu beschäftigt
1904984383---Ward-Ward-Award_Bin_I18nn_js. Aber innerHTML ändert sich beim Klicken auf "Ja". Ich bin sehr verwirrt, jede Hilfe wird geschätzt, hier der Code-Snippet: < /p>

Code: Select all






Are you sure the review of  has finished and its content is up to date?
Yes
No





console.log("JavaScript is running!");
const modal = document.getElementById("modalDiv");
console.log("Modal Element:", modal);
const yesBtn = document.getElementById("yes");
console.log("Yes Button:", yesBtn);
const noBtn = document.getElementById("no");
console.log("No Button:", noBtn);
const question = document.getElementById("question");
const content = document.getElementsByClassName("modal-content")[0];

const load = function () {
console.log("Modal loaded.");
modal.style.display = "block";
}

yesBtn.addEventListener('click', () => {
alert("Yes button clicked!");
console.log("Yes button clicked.");
question.style.display = "none";
const yesResponse = document.createElement('p');
yesResponse.innerHTML = 'Thanks for completing the review/update of the   document. We have updated the status of your document  to Ready and reset your next review date. You will no longer receive notifications for this review period. Have a great day!';
content.appendChild(yesResponse);

try {
const documentData = ;
console.log("Sending document data to setDocumentAsReady:", documentData);

if (!documentData.name || !documentData.url) {
console.error("Error: Document data is missing!", documentData);
return;
}

google.script.run
.withSuccessHandler(() => console.log("setDocumentAsReady() executed successfully."))
.withFailureHandler(error => console.error("Error calling setDocumentAsReady:", error))
.setDocumentAsReady(documentData);

} catch (err) {
console.error("JavaScript Error:", err);
}

// google.script.run.setDocumentAsReady();
});

noBtn.addEventListener('click', () => {
console.log("No button clicked.");
question.style.display = "none";
const noResponse = document.createElement('p');
noResponse.innerHTML = 'Ok.  Please come back again when the review of  finishes and its content is up to date';
content.appendChild(noResponse);
});


`
< /code>
function setDocumentAsReady(documentStr) {
try {
console.log(`setDocumentAsReady received request: ${documentStr}`);
const documentObj = JSON.parse(documentStr);
console.log(`Setting document ${documentObj.name} with url ${documentObj.url} as Ready`)
const scriptProperties = PropertiesService.getScriptProperties();
scriptProperties.setProperty(documentObj.url, 'Ready');
} catch (err) {
console.log(`Failed with error ${err.message}`)
}
}

< /code>
I suspect there is something wrong in setDocumentAsReady(), so I tried adding in console.log(setDocumentAsReady received request: ${documentStr}
); Und es gibt mir zurück: setDocumentAsReady empfangene Anfrage: undefiniert, so dokumentiert Frontend nicht die Datei, die aktualisiert werden muss.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post