How can I make Lookup Asynchronous ?
Hey All,
I want my eFormHelper.executeLookup method to wait until it finishes getting all the data and then execution control should go to next line of code. That means in below sample code first it should do all the works defined in call back function and after that it should execute console.log('Got the Data');
Output of the below code should be : 1. Success\Error 2. Got the Data
Instead I am getting output as : 1. Got the Data 2. Success\Error
Any help would be really apricated.
function getData() {
var options = {};
options.lookupName = 'LookUpName';
options.lookupType = eFormHelper.constants.lookuptype.multicolumn;
eFormHelper.executeLookup(options, function (result) {
if (result.isSuccess) {
console.log('Success');
}
else {
console.log('error');
}
});
console.log('Got the Data');
}
Thanks!
-
Hello Vinay,
The Lookup execution is an Asynchronous execution itself. We understand that there might be some cases where the response would be required and therefore AgilePoint provides a “callback” which would be executed once lookup execution is done. Anything which is dependent on lookup completion has to be inside “callback”.
You can pass the callback method as a parameter and execute after executeLookup as content below.

Thanks
請登入寫評論。
評論
1 條評論