# How to populate a selectBox dynamically?

**URL:** <https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673>\
**Category:** Developers\
**Created:** [April 29, 2016, 10:04pm UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673 "2016-04-29T22:04:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thormelk](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@thormelk](https://forum.bpmn.io/u/thormelk)\
**Post date:** [April 29, 2016, 10:04pm UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/1 "2016-04-29T22:04:01Z")

</div>

Hi.  
How can I populate a selectBox in the property panel?

I can do it statically like this:

```
 if (is(element, 'bpmn:Lane')) {
    group.entries.push(entryFactory.selectBox({
      id : 'myEntity',
      description : '',
      label : 'myEntity',
      selectOptions : [ { name: 'name1', value: 'value1' },
                                 { name: 'name2', value: 'value2' }],
      modelProperty : 'myEntity'
   }));

```

Now, I’d like to assign selectOptions dinamically, how can I do that?

Is there any documentation about the use of set and get functions when defining and entry?

---

<div class="post-metadata">

**Author:** ![vladimirs.katusenoks](https://forum.bpmn.io/user_avatar/forum.bpmn.io/vladimirs.katusenoks/32/216_2.png) [@vladimirs.katusenoks](https://forum.bpmn.io/u/vladimirs.katusenoks)\
**Post date:** [May 2, 2016, 8:28am UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/2 "2016-05-02T08:28:06Z")

</div>

Hi,

Every time you switch focus from other element to this one, `group.entries.push(entryFactory.selectBox(...)` would be called again.

So just generate values before that call and provide them as `selectOptions`.

Hope this helps.

Cheers,  
Vladimir

---

<div class="post-metadata">

**Author:** ![thormelk](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@thormelk](https://forum.bpmn.io/u/thormelk)\
**Post date:** [May 2, 2016, 3:17pm UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/3 "2016-05-02T15:17:10Z")

</div>

Hi.  
My data to populate de selectOptions are coming from and ajax request, this ajax request returns a json, then I parse this json to convert it in an object array [{name: ‘aname’, value: ‘avalue’. …]. having that result, how can I update the selectOptions async?

---

<div class="post-metadata">

**Author:** ![pedesen](https://forum.bpmn.io/user_avatar/forum.bpmn.io/pedesen/32/107_2.png) [@pedesen](https://forum.bpmn.io/u/pedesen)\
**Post date:** [May 11, 2016, 8:51am UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/4 "2016-05-11T08:51:31Z")

</div>

Hi @thormelk,

there is no proper way of updating the selectOptions in an async way. You could try to inject the options from your ajax call into the DOM after a request is received, but this would be more of a workaround.

I created an [issue](https://github.com/bpmn-io/bpmn-js-properties-panel/issues/186) for that, because we should support that natively in the long term.

---

<div class="post-metadata">

**Author:** ![vladimirs.katusenoks](https://forum.bpmn.io/user_avatar/forum.bpmn.io/vladimirs.katusenoks/32/216_2.png) [@vladimirs.katusenoks](https://forum.bpmn.io/u/vladimirs.katusenoks)\
**Post date:** [September 20, 2016, 11:24am UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/5 "2016-09-20T11:24:35Z")

</div>

Please see [this thread](https://forum.bpmn.io/t/dynamically-load-data-in-properties-panel/796/8) for more details.

---

<div class="post-metadata">

**Author:** ![vladimirs.katusenoks](https://forum.bpmn.io/user_avatar/forum.bpmn.io/vladimirs.katusenoks/32/216_2.png) [@vladimirs.katusenoks](https://forum.bpmn.io/u/vladimirs.katusenoks)\
**Post date:** [September 20, 2016, 11:24am UTC](https://forum.bpmn.io/t/how-to-populate-a-selectbox-dynamically/673/6 "2016-09-20T11:24:39Z")

</div>

Closed on September 20, 2016, 11:24am UTC


