How to retrieve a case variable from the UI

Hi

I have a process with a process (case) variable (a simple long value).

I want to use its value in a form, and it seems excessively complicated.

In the UI Designer:

  • get the taskID in a variable
  • get the task from taskID using External API
  • get the process ID from the task using javascript
  • get the variable (javascript object) using the process id, the variable name, and the External API
    …/API/bpm/caseVariable/{{caseId}}/myVariable
  • get the value from the variable using javascript ($data.myVariable.value).

Is there a more sensible and shorter way to get the value of the variable to put it in my form ?

Thanks

2 Likes

Hi!
I think you can simply add the variable you want in the UI to the contract of the task. In this way, the automatically generated UI form should contain a field that maps your variable.

Hope this helps!
Best