How can I call 2 files (1 html & 1 js) for the same user task form from Modeler?


#1

Hi to all.

I would like to know how can I call from Modeler 2 files (1 html & 1 js) which both of them are for the same user task form?
In case of having to call 1 html form from a user task, I simply write the embedded:app:forms/file_name.html into the Form Key field of the Forms Tab (as in my following screenshot).

But what if in case I’ve written my javascript in an external js file and thus I want to call 2 files instead of 1 from Modeler?
I ask this because I have the impression that my external javascript doesn’t play in case I don’t reference it somewhere in my Modeler. :face_with_raised_eyebrow:

Does anyone know please?

Thanks,
Steve


#2

Hi @steftriant

Camunda works with one Form Key per User Task and if you wanna make use of embedded html forms in the Tasklist this should be .html and not a JS file.
If you want to work with external JS files, you could:
a) Add it in the Tasklist config: https://docs.camunda.org/manual/7.9/webapps/tasklist/configuration/#custom-scripts
b) Reference it within your html file (having the disadvantage that it will load every time you choose a different task)

Best
Felix


#3

Hi @felix-mueller

Thanks for your answer.

I’m not aware of the 1st one so I have to read it carefully in Docs.

As for your 2nd suggestion, I had already referenced the external js file into the script call of my html file as you can see in my last post here:
“Add” button isn’t displayed in my html task form.
But in that case, my problem is that my javascript doesn’t seems to play. And I supposed that the reason was the js file reference from Modeler.

What do you mean when you say that the external js file will load every time I choose a different task? I ask this because each user task is connected with a different html file in Modeler. So, what is the disadvantage in that case?

Best regards,
Steve