# Connector to update variable

**URL:** https://community.ofelia.com/t/connector-to-update-variable/8047
**Category:** Q&A
**Created:** [30 December 2016 16:13 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047 "2016-12-30T16:13:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tcarmo20](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@tcarmo20](https://community.ofelia.com/u/tcarmo20)
#### Post date: [30 December 2016 16:13 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047/1 "2016-12-30T16:13:10Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)
#### Post date: [3 January 2017 09:47 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047/2 "2017-01-03T09:47:16Z")

</div>

Hi,

The best starting point is the [documentation](http://documentation.bonitasoft.com/?page=connectors-overview) 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](http://documentation.bonitasoft.com/?page=operations) of Operation which seems to suit your needs better.

Cheers.

---

<div class="post-metadata">

### Author: ![tcarmo20](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@tcarmo20](https://community.ofelia.com/u/tcarmo20)
#### Post date: [3 January 2017 11:47 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047/3 "2017-01-03T11:47:07Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)
#### Post date: [3 January 2017 12:49 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047/4 "2017-01-03T12:49:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tcarmo20](https://avatars.discourse-cdn.com/v4/letter/t/977dab/32.png) [@tcarmo20](https://community.ofelia.com/u/tcarmo20)
#### Post date: [3 January 2017 16:46 UTC](https://community.ofelia.com/t/connector-to-update-variable/8047/5 "2017-01-03T16:46:23Z")

</div>

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 😉
