I have a simple node application which transfers some data from one API to another... I am facing a problem in the following code where my argument "SMS" and "callback" is not visible in the child function....
module.exports = new importer();
var api = require('../../api')
var config = require('../../config.json');
var constants = require('./constants');
var dhis2api = new api(config)
function importer(){
this.init = function(SMS,callback){
// fetch options
dhis2api.getObj("optionSets/"+constants.metadata.optionset_indicator_level+"?fields=id,name,options[id,name,code,attributeValues[value,attribute[id,name,code]]]",function(error,response,body){
if (error){
__logger.error("Unable to fetch option set for Indicator Levels. Aborting.");
return
}
var options = JSON.parse(body).options;
**// >>>>> "SMS" HERE COMING AS UNDEFINED <<<<<**
debugger
});
}
}