Form loading forever on tasklist due to undefined variable

Hello,

I face an issue on Tasklist with embeeded forms, once a variable is not defined and the cam-file-download directive is used.

For example, I have the following:

If the variable “document” is not defined prior to the task creation, then I face the following error:

How can I check inside my form if the variable “document” is already defined for the specific process instance? If so, then I want to show the download link, otherwise a message that “no document” is attached, it will be shown.

Thank you.

1 Like

@camunda
can you help me on that?

@NIKOLAOS_NOUSIAS,

You can issue a rest call to check whether form variable is defined for a particular process instance.

GET /process-definition/anId/form-variables

Camunda provides REST API to check each and every variable. Please take a look at Camunda documentation.

Then you can take necessary action. Hope this helps.

@cpbpm thanks for your reply and your kindness to share your ideas with me.

I would like to know how could I make the REST API call from the form. Should I use just plain JavaScript or do I need to consider other parameters (like angular directives) in order to make the REST API call?

An example or a similar thread would be really useful for me in order to understand the funcionality.

Thank you in advance.

Are you using custom forms, if yes, you can use either java script can be used to invoke REST API to know whether variable exists for a particular process instance. From Google, check how to invoke Rest API using java script.