Dynamic cam variable name


#1

Is there a way of assigning cam-variable-name an AngularJS string variable value, eg cam-variable-name={{variableName}}?


#2

Hi Eugene,

please share some more insights. Do you want to pass it as a parameter to a directive or in which context do you want to assign the cam-variable-name?


#3

Hi @FabianHinsenkamp

I’m trying to dynamically assign the cam-variable-name directive on <input> tags in Embedded forms. From experimentation, I somehow deduct that the cam-variable-name directive has to be resolved at the time the form loads. For all variable types other than File this is not a problem as you can simply use camForm.variableManager.createVariable at onSubmit, but for File you have to create the File datatype in order to submit it correctly, which I’ve managed to do thanks to Upload multiple files in embedded form

However, for downloading a file with the cam-file-download directive, it’s not as easy if the name is not a literal, but dynamically generated after the page was loaded, ie cam-file-download={{vFileOrder}} does not work but it represents what I’d like to achieve.


#4

Hi Eugene,

as you already found out, the cam-file-download has to be set when the form is initially loaded, so you probably can’t use it if your variable name is not known at that time. If you have a look at how the download link is put together, you will find that it will always follow the same pattern: /task/{taskId}/variables/{variableName}/data. Using this information, you can just create your own download link instead of using the cam-file-download directive.

Does this help you?

Best regards
Sebastian


#5

Great
Thanks so much @sebastian.stamm


#6

Hi @eugene, @sebastian.stamm and @FabianHinsenkamp.

Please let me describe my issue here:

On the submittion of my task form, a PDF document is generated and is saved in a directory path of my choice.

Could you please guide me a bit on how can this document be downloaded on the submittion of the task form (instead of being saved) ?

My initial thought was to work with a “submit” Event Listener in order to create an additional “File” variable (with the name of my PDF document) but I’ve just read here that the cam-file-download directive only works when the form initially loads.

Thank you in advance,
Steve


Create a document from an embedded task form