These are chat archives for effektif/effektif

7th
Apr 2016
Stefano
@esseti
Apr 07 2016 08:14
Hello there, is there anything that i can use to parse an XML response within a JS task? what is enabled/available?
Christian Wiggert
@SilentGert
Apr 07 2016 08:23
We didn’t include any specific library for XML parsing, if that is what you are looking for.
if it is a smaller xml response, you might use regular expressions
Stefano
@esseti
Apr 07 2016 08:24
i see, actually i was trying anything that i can use, but so far i found no way to parse a xml. i did image that there was no library for that.
PS: what are the libraries that are enabled in the JS script?
Christian Wiggert
@SilentGert
Apr 07 2016 08:31
I had to check, we definitely have to document that better
  • and you can use console for log output
  • and in general the vanilla JS API which is available in Node.js
Stefano
@esseti
Apr 07 2016 08:36
about vanilla, this should work function new DOMParser()? i got it from here https://www.npmjs.com/package/vanilla-js-dom
Christian Wiggert
@SilentGert
Apr 07 2016 08:41
ahh sorry
with vanilla I meant plain JS API
Stefano
@esseti
Apr 07 2016 08:42
got it. thanks
Stefano
@esseti
Apr 07 2016 09:07
another question, is it possible to bind arrays to variables that are passed between JS scripts? i found int and string, but nothing for arrays.
Christian Wiggert
@SilentGert
Apr 07 2016 09:12
it should work to reuse list variables from the workflow for that purpose
Stefano
@esseti
Apr 07 2016 09:12
you mean choice?
Christian Wiggert
@SilentGert
Apr 07 2016 09:13
no, currently you cannot create lists in the variable selection for the js task
Stefano
@esseti
Apr 07 2016 09:14
so, i've to pass them as string and do the conversion
with the JSON library
Christian Wiggert
@SilentGert
Apr 07 2016 09:14
Bildschirmfoto 2016-04-07 um 11.14.07 .png
you can change a variable type to a list in the user tasks form configuration
Stefano
@esseti
Apr 07 2016 09:15
so, i've to create a form and reuse the field for the list in the JS.
Christian Wiggert
@SilentGert
Apr 07 2016 09:15
that’s the current workaround
although, your option of parsing a string would work as well
you have to rely on that if you want to pass around complex json objects
Stefano
@esseti
Apr 07 2016 09:23
yup
thansk
Christian Wiggert
@SilentGert
Apr 07 2016 09:24
just a tip, if you use lists and do something like:
names.push("b");
names = names;
make sure to have an assignment to the workflow variable at the end
otherwise the value is not persisted properly