Connector to update variable

1
0
-1

Hi!
I'm having a hard time understanding how to create connectors. I want to create one that receives a value (a date) stored in the bdm and updates the value of a process or task variable with that received value.
Any hints?
Thanks in advance!

1 answer

1
0
-1
This one is the BEST answer!

Hi,

The best starting point is the documentation for that.

You can see a connector as a Java method executed at a specific moment in the process lifecycle that receive a set of inputs and return a result.

In your case, I think you should take a look to the concept of Operation which seems to suit your needs better.

Cheers.

Comments

Submitted by tcarmo20 on Tue, 01/03/2017 - 12:47

Thanks Lionel.
I understood everything (I think) till the point of implementing the Java class.
In the Java class, as per the documentation, I implemented the Connector class. Then, in the execute method, I simply wrote:

parameters.put("Something", 1);
return parameters;

(parameters is a Map<String,Object>) and I didn't do anything else besides setting the input parameters (this.parameters = parameters).

But the variable taking the value returned by the connector still has null as it's value. Shouldn't it have the String "Something" as the value?

Submitted by Lionel Palacin on Tue, 01/03/2017 - 13:49

In the executeBusinessLogic method, you should call the method setResult(result) to set the output of the connector.

Submitted by tcarmo20 on Tue, 01/03/2017 - 17:46

Thank you very much! I am now able to update a variable value!
Now I have another question..How can I pass an input to the connector? I'm asking this because the method setInputParameters only accepts a Map..I would like it to receive, for example, a String.
How can I pass, well, something, to the connector, and have that something be a string?

If it helps, I want to do the following:

I want to change the expected end date of a task. For that I want to make a connector that receives the expected end date (I don't exactly know how I'm going to obtain it, but i'll figure it out ;) ), changes it to something else (for example to working days), and returns that changed date, which I will than apply to the task. Basically, that's it ;)

Notifications