Hi Alexander,
Although that typeof error does get thrown regardless of the return value, I'm not sure there is much use in getting the type of the callback argument, since it will always be an array of execution results. However, in the code below:
function main(){
MccApp.accounts().withLimit( 2 ).executeInParallel( 'processAccount', 'finalProcessing' );
//Using 2 accounts in this example
}
function processAccount(){
return 'test';
}
function finalProcessing( arg ){
for(var i = 0; i < arg.length; i++) {
Logger.log(typeof arg[i]);
Logger.log(typeof arg[i].getReturnValue());
}
}
The log is:
object
string
object
string
Since, arg[i] is an execution result object, the typeof operator returns 'object'. You need to use the
getReturnValue method on the execution result to get the actual value of that result.