Hi Kamala,
You need to make use of promises for this. Instead of returning a string directly, you resolve a promise when the result is available. Please see the following pages for more information:
See the 8th bullet in the last link for an example of how to use a promise to return an asynchronous result.
So your Javascript action should contain something like:
function getFromExternalSource() {
// BEGIN USER CODE
// We're returning a Promise, which will resolve with a value
return new Promise(function (resolve, reject) {
// We call the external library with method getValue. getValue expects a callback
somexternalThingy.getValue(function (returnValue) {
// When the value comes from this async function callback, we resolve the value
resolve(returnValue);
})
})
// END USER CODE
}