Promise base property


#1

I am working on bpmn-js-properties-panel.

I am trying to add some pre-populated properties for the startEvent in table format using TableEntryFactory

And I have added properties for startEvent by passing static data using PropertiesProvider same as in custom Proerties

But now I am trying to pass data which will be the ajax response. But request takes time and execution go out of it with the blank object.

For simplification,
Suppose I am trying to create select dropdown with dynamic data as

var entryFactory = require(‘bpmn-js-properties-panel/lib/factory/EntryFactory’);
var is = require(‘bpmn-js/lib/util/ModelUtil’).is;

if (is(element, ‘bpmn:StartEvent’)) {

//here I am calling ajax request and response is stored in tableObject. this will something like below
something.getTables().then(function(data){
tableObejct=data
}

group.entries.push(entryFactory.selectbox({
 id: 'tables',
  description: '',
  label: 'Table Name',
  selectOptions: tableObject,
  modelProperty: 'table',
}));

}
};

but before getting response execution goes out of it.

How to deal with such situation.
Please suggest me the better way to achieve this.