Hello!
Is it possible to call camForm
from the Custom Scripts in Task List? I see that I can inject camApi
. I need this in order to save variables into the process between process steps.
Thanks and kind regards,
Deniss
Hello!
Is it possible to call camForm
from the Custom Scripts in Task List? I see that I can inject camApi
. I need this in order to save variables into the process between process steps.
Thanks and kind regards,
Deniss
Hi Deniss
Heres a link to the docs which indicate how to create a new variable within a form and inject it into the process using camForm [1]
regards
Rob
[1] https://docs.camunda.org/manual/7.7/reference/embedded-forms/json-data/#creating-a-new-json-variable
Thanks, but I’m not talking about variable manipulation from the embedded forms, but from Custom Script: https://docs.camunda.org/manual/7.3/guides/user-guide/#tasklist-customizing-custom-scripts
@sebastian.stamm maybe you can advise?
Thanks and kind regards,
Deniss
Hi Deniss,
custom scripts are conceptually different than embedded forms. Custom scripts get executed only once when the page loads. You can of curse write an angular module in the custom script that you can then inject in an embedded form.
However, I think for saving variables in the process between process steps, you should actually save them as process variables.
Cheers
Sebastian
@sebastian.stamm Thanks Sebastian!
I have a JSON object variable in the process, that was created before in the previous process step and I want to work with it in Custom Scripts
and then after save it for future manipulation in further steps. Is there a way to do that? Maybe by injecting camApi
into my custom scripts?
Thanks and kind regards,
Deniss
Hi Deniss,
camAPI
is an angular service for the camunda-bpm-sdk. It basically allows you to make REST-requests. But you can use custom scripts to create a new angular service that you can inject in embedded forms. You can check out an example about how to use custom scripts and read more about angular services.
The variable itself should definitely be saved as process variable. Otherwise you could lose the variable if the user refreshes the page or clears the browser cache. It should look something like this:
Does this help you?
Cheers
Sebastian
Hi @sebastian.stamm thanks for your outlined solutions.
That’s basicaly how I did it also, but wanted to know if there was a cleaner
solution.
Kind regards,
Deniss