I am trying to add attachments dynamically to an auto-generated email. As explained here, the connector requires to specify the values of the variable "fileNames" that references the attachment location at the modeling stage. The value of the variable itself can be changed dynamically at the process execution stage. However, in my case, I would like to dynamically add or retrieve values from the list variable
"fileNames".
The screenshot below shows the static entries that I am using currently to fill the list "fileNames".
you could use a process variable which includes all file names you want to attach. You can change the variable in your process and reference it in the connector as fileNames.
Step 1: Create a process variable in a Delegate Class whish is called before the sendEmail Action.
In this variable, I put all my file names that I want to attach to my email.
The variable I created has the same name as the connector input parameter fileNames: execution.setVariable("fileNames", fileNamesPath);
Step 2: I kept the declaration of āfileNamesā input parameter in the process model (as shown in the screenshot below). However, this time, I havenāt specified any item value for the list fileNames. I was hoping, in somehow, the process will pick the values from the process variable names that I created in step 1 but it does not
I donāt see how can I reference explicitly the process variable that I created (step 1), in the āfileNamesā input parameter of the Connector.
Is there a mean to set the connector input parameter to the process variable I defined earlier ? something like Connector.fileNames=${myfileNamesVariable}?
try to set the input parameter filesNames to type Text and value ${fileNamesPath}. This should use the process variable which is defined in the previous task.
I couldnāt imagine that setting the connector parameter fileNames as āāTextāā, which is not complaint to the type that is specified in the connector documentation (List), would never work!
I was expecting a big error caused by an illegal cast of text as a list but fortunately, there was no error
The engine adapted the type of the text parameter I declared using the type of the referenced process variable: amazingly smart
Hello,
Iām beginner to Camunda, I used a connector too and I need to send mail data (like the recipient, subject message⦠) dynamically. Regarding the conversation and documentation,
I used a delegate class where i set the variable execution.setVariable(āvarNameā, varValue)
set the input parameter assignement value in panel properities to ${varName} or ${varValue} camunda:connector camunda:inputOutput
<camunda:inputParameter name=āmessageā>Message</camunda:inputParameter>
<camunda:inputParameter name=āsubjectā>Subject</camunda:inputParameter>
<camunda:inputParameter name=ātoā>${varName}</camunda:inputParameter>
</camunda:inputOutput> camunda:connectorIdmail-send</camunda:connectorId>
</camunda:connector>
But it gives this error Unknown property used in expression: ${varName}, I know that I miss something
Any help, thank you
Thank you for your reply @aravindhrs,
You can find attached the bpmn model. So here is the thing, I used a JavaDelegate to set this variable, but because my task implement a connector, it seems like there is no contact to understand the variable thatās why they give this error āUnknown property used in expression: ${varName}ā, and for me I want to let the connector to send emails. connector-ex.bpmn (3.8 KB)
Thank you
Hello @aravindhrs,
I knew that Iāve missed something, It was exactly the listener config. I forget adding the listener and point it to my JavaDelegate.
Thank you very much @aravindhrs