No way around the xas calls but you can speed them up using Promise.all which will run the calls in parallel instead of sequentially. See sample code below
In the end it might be faster to use a microflow for this instead of a java action.
function createObjectAsPromise(entityName) {
return new Promise((resolve, reject) => {
mx.data.create({
entity: entityName,
callback: resolve,
error: reject
});
}
var arr = [0,1,2,3,4,5,6,7,8,9];
// create 10 objects in parallel and store them in an array
let objs = await Promise.all(arr.map(i => createObjectAsPromise("Module.Entity")));
-Andrej
Mendix has said that nanoflows are primarily meant for offline apps and are not meant to be used in online apps. I do not expect any optimizations in regard to online apps soon
https://forum.mendix.com/link/questions/89974
-Andrej