I have a script task that results me an ‘com.oracle.truffle.polyglot.PolyglotMap’ instead of an ‘java.util.ArrayList’ and i dont know why.
here’s my JS script:
const filesValidation = execution.getVariable("filesValidation");
const filesAttachments = execution.getVariable("filesAttachmentsFromHearing");
const filesToReupload = []
if (Array.isArray(filesValidation) && Array.isArray(filesAttachments)) {
for (const file of filesAttachments) {
if (
file.file.fileId === filesValidation[filesAttachments.indexOf(file)].id &&
filesValidation[filesAttachments.indexOf(file)].isValid === false
) {
filesToReupload.push(file);
}
}
execution.setVariable("filesToReupload", filesToReupload);
}
i’ve tryed many ways but filesToReupload still beying a 'com.oracle.truffle.polyglot.PolyglotMap
Hello my friend! Are you Brazilian, right?
If so… me too!
Welcome to the community brother!
Try doing it this way, declaring filesToReupload
as an ArrayList explicitly…
const filesValidation = execution.getVariable("filesValidation");
const filesAttachments = execution.getVariable("filesAttachmentsFromHearing");
const filesToReupload = new java.util.ArrayList();
if (Array.isArray(filesValidation) && Array.isArray(filesAttachments)) {
for (const file of filesAttachments) {
if (
file.file.fileId === filesValidation[filesAttachments.indexOf(file)].id &&
filesValidation[filesAttachments.indexOf(file)].isValid === false
) {
filesToReupload.add(file);
}
}
execution.setVariable("filesToReupload", filesToReupload);
}
I think this will solve your problem.
William Robert Alves
from another account… yes, im Brazilian ahaha
got that working by using the following:
const data = new java.util.HashMap();
data.put("name", "Bruno");
data.put("gender", "male");
const filesToReupload = new java.util.ArrayList();
filesToReupload.add(data);
execution.setVariable("filesToReupload", filesToReupload);
so on, just have to add for() and build it up
thx homie <3
system
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.