Hi,
I am using APEX 19.1
We are using a 3rd party JS plugin in the application.
This JS has a defined function to evaluate a value like
a.b.c = function(arg){
var a = arg * 10;
return a;
}
Now, I want to calculate the value from DB - So, I modified the function as
a.b.c = function (arg) {
var a = getValueFromDB(arg);
console.log('Value - a --- ' + a);
return a;
}
function getValueFromDB(p){
apex.server.process("GET_VALUE", {
x01: p
}, {
//pageItems: ''
dataType: 'text'
}).done(function(pData) {
console.log("value -- " + pData);
return pData; /// IS this a correct syntax??
});
}
My console.log is
value - a --- undefined
value -- 20 /// Correctly fetched from DB
So my main function always return undefined
How do I wait for my apex.server.process to finish and return the value from it before I return the value from my main function?
Please suggest.
Thanks,
Veerendra.