This is the function that is supposed to return name :
function getLookupNameById(lookup_id, callback){
var name = "";
if(lookup_id != 0) {
updateData({
lookup_id: lookup_id,
callback: function(status, data){
if( status && data.values){
values = data.values;
name = somevalue;
return name; //returns undefined
}
else{
console.log('Empty');
}
if(callback)
callback();
}
});
}
return name; //returns empty string
}
This is how i am calling the function from another script :
var name = instanceofscript.getLookupNameById(parameter);
How should i return the value??