cancel
Showing results for 
Search instead for 
Did you mean: 

error:using JavaScript in .bpmn20.xml

bearson
Champ in-the-making
Champ in-the-making
Hi dear community, I tried to use JS like that:

<process id="test_model" isExecutable="true">
        <startEvent id="414-013"></startEvent>
        <scriptTask id="javascriptScript" name="jsTask" scriptFormat="JavaScript" activiti:autoStoreVariables="false">
            <script><![CDATA[
                var my = "Bla bla bla";
                console.log(my);
            ]]></script>
        </scriptTask>
        <endEvent id="0DC2EF"></endEvent>
    </process>


This xml uploaded perfect, but when I try Start Process, I have error:

<javascript>Reference Error:"console" is not defined at line 3</javascript>

Also I tried create new Form in js:

var form = new FormData();


And again I have the same error.

What I`m doing wrong? In what this error?

Thank you for help
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
The javascript interpreter in the JDK does not have the 'console' object, like in a browser.

Use java.lang.System.out.println() (you can do some imports to get away with the code)

Also, js doesn't know anything about the packages. You probably need to add the package before FormData to make it work.

jbarrez
Star Contributor
Star Contributor
The javascript interpreter in the JDK does not have the 'console' object, like in a browser.

Use java.lang.System.out.println() (you can do some imports to get away with the code)

Also, js doesn't know anything about the packages. You probably need to add the package before FormData to make it work.

bearson
Champ in-the-making
Champ in-the-making
thanks a lot, will try to do same, but with import packages.
But what package need for FormData?
Am I right, that all js methods will interpreted in Java to JVM?