Populate dropdown when custom palette activity is on canvas

I using the camunda modeler at my project and create custom entries on the palette.

Here is a template of the custom element

{
"name": "Select Room",
"id": "com.avispl.symphony.delegate.camunda.SelectRoom",
"appliesTo": ["bpmn:ServiceTask"],
"properties": [
  {
    "label": "Select Location",
    "type": "Dropdown",
    "choices": [
      { "name": "Topic 1", "value": "nameOfTopic1" },
      { "name": "Topic 2", "value": "nameOfTopic2" }
    ],
    "binding": {
      "type": "camunda:inputParameter",
      "name": "roomId"
    }
  },
  {
    "label": "Java Class",
    "type": "String",
    "value": "com.avispl.symphony.delegate.camunda.SelectRoom",
    "editable": false,
    "binding": {
      "type": "property",
      "name": "camunda:class"
    }
  }
],
"entriesVisible": {
  "_all": false,
  "name": true
  }
}

When I drag this element to canvas I need to populate choices with JSON from server

I have functions for this.

How I can to run this function and populate dropdown?

If you want to add entries to Palette, you can call palette.registerProvider method.

This could look like:

const modeler = new BpmnJs(/* params */);

fetch('https://example.com')
  .then(res => res.json())
  .then(customEntries => {
    const palette = modeler.get('palette');
    const paletteProvider = {
      getPaletteEntries() {
        return customEntries;
      }
    };

    palette.registerProvider(800, paletteProvider);
  });

However, you mentioned dropdown which is not part of the Palette. Can you show on a screenshot where exactly you’d expect the entries to appear?