I am very new to app scripts. What I would like to do is to create a pop up message in google sheet, when proposal probability is goin above 75% - directing the user to go to a google form to fill.
When I call the "popup" function from outside - it is working. When I embed it into the If formula and I try to call it from there, it is not working, but the other instruction called in same place is executing properly.
I do not understand what is wrong.
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Pipeline track');
var range = e.range;
if (range.getColumn() == 11) {
var value = range.getValue();
if (value >= 0.75) {
range.setValue(1);
showAnchor('Capacity planning', 'https://docs.google.com/');
} else {
range.setValue(0);
}
} else {
range.setValue(10);
};
}
function popup() {
showAnchor('Capacity planning', 'https://docs.google.com/');
}
function showAnchor(name, url) {
var html = '<p>Your proposal reached the stage where we need to reflect it in our operational pipeline - with basic project details </p> <p>Please fill in the below Google Form!</p> <html><body><a href="' + url + '" target="blank" onclick="google.script.host.close()">' + name + '</a></body></html>';
var ui = HtmlService.createHtmlOutput(html);
SpreadsheetApp.getUi().showModelessDialog(ui, "Capacity planning");
}
Aucun commentaire:
Enregistrer un commentaire