I can't pass the value from one function to another

Hi everyone, I am a beginnner in Apps scripts and I am trying to pass a value from function maxcode with the return method to function registerdata to get it in the variable proinfo.code but it doesn’t work. I don’t know what I am doing wrong. Please, someone help me. thanks a lot.

function getcode(){
google.script.run.withSuccessHandler(maxcode).getmaxvalue();
}

function maxcode(codem){

cod = codem + 1;

return cod;

}
function registerdata(){
var proinfo = {};

proinfo.code = cod; //I have tried this too: proinfo.code = maxcode() and this one proinfo.code = maxcode(cod) but nothing seems to work.

var catlow = document.getElementById(‘cat’).value.toLowerCase();
proinfo.catg = catlow.charAt(0).toUpperCase()+catlow.slice(1);

var desclow = document.getElementById(‘dsc’).value.toLowerCase();
proinfo.desc = desclow.charAt(0).toUpperCase()+desclow.slice(1);

}

0 1 106
1 REPLY 1

Steve
Platinum 4
Platinum 4

You’ve posted this to an AppSheet forum. In-depth discussion of App Script is inappropriate.

Top Labels in this Space