# Changes to Delegate entries under servive Task for bpmn properties panel not getting updated on UI

**URL:** <https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171>\
**Category:** Discussion & Questions\
**Created:** [March 24, 2017, 11:04am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171 "2017-03-24T11:04:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinodlouis](https://forum.camunda.io/user_avatar/forum.camunda.io/vinodlouis/32/1368_2.png) [@Vinodlouis](https://forum.camunda.io/u/Vinodlouis)\
**Post date:** [March 24, 2017, 11:04am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/1 "2017-03-24T11:04:45Z")

</div>

**Admin edit** : Also asked on stackoverflow: [javascript - Changes to Delegate entries under servive Task for bpmn properties panel not getting updated on UI - Stack Overflow](https://stackoverflow.com/questions/42998224/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-get)

* * *

I’m trying to modify the Details section of General Tab under type Service Task.

**What I want ?**  
I’m trying to achieve that when user selects Implementation type as JavaClass I show an dropdown for delegate field instead of an textbox where on any other selection other than JavaClass it shall be textbox.

Later I want to load dynamic data into the dropdown.

**What I tried ?**  
I tried the following 2 ways (code for 2nd attached)

1 : Edited file [camunda\parts\implementation\Delegate.js](https://github.com/bpmn-io/bpmn-js-properties-panel/blob/354d4ebc845a1e546b91903a7527dc95a1135b8e/lib/provider/camunda/parts/implementation/Delegate.js) to take one more var which stores entryFactory.selectBox and on type == class return the newly created select box in module.exports else return the default textbox.

```
module.exports = function(element, bpmnFactory, options) {

  var getImplementationType = options.getImplementationType,
      getBusinessObject = options.getBusinessObject;

  var delegateEntrySelect = entryFactory.selectBox({
    id: 'delegate',
     label: 'Value',
    selectOptions: [
      {value:"one",name:"one"},{value:"two",name:"two"}
    ],
    modelProperty: 'delegate',
    emptyParameter: false,

    get: function(element, node) {
      var bo = getBusinessObject(element);
      var type = getImplementationType(element);
      var attr = getAttribute(type);
      var label = getDelegationLabel(type);
      return {
        delegate: bo.get(attr),
        delegationLabel: label
      };
    },

    set: function(element, values, node) {
      var bo = getBusinessObject(element);
      var prop = {};
      prop[attr] = values.delegate || '';
      return cmdHelper.updateBusinessObject(element, bo, prop);
    },

    validate: function(element, values, node) {
      return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {};
    }

    /*,

    disabled: function(element, node) {
      var type = getImplementationType(element);
      console.log("SELECT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class")))
      return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class"));
    }*/
  });   

  var delegateEntry = entryFactory.textField({
    id: 'delegate',
    label: 'Value',
    dataValueLabel: 'delegationLabel',
    modelProperty: 'delegate',

    get: function(element, node) {
      var bo = getBusinessObject(element);
      var type = getImplementationType(element);
      var attr = getAttribute(type);
      var label = getDelegationLabel(type);
      return {
        delegate: bo.get(attr),
        delegationLabel: label
      };
    },

    set: function(element, values, node) {
      var bo = getBusinessObject(element);
      var type = getImplementationType(element);
      var attr = getAttribute(type);
      var prop = {};
      prop[attr] = values.delegate || '';
      return cmdHelper.updateBusinessObject(element, bo, prop);
    },

    validate: function(element, values, node) {
      return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {};
    }

    /*,

    disabled: function(element, node) {
      var type = getImplementationType(element);
      console.log("TEXT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class")))
      return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class")); 
    }*/  
  });

  var eleTOReturn = (getImplementationType(element) && getImplementationType(element) == "class") ? delegateEntrySelect : delegateEntry
  console.log("returning ele",eleTOReturn)
  return [eleTOReturn];
};

```

What i get in output is :

 ![](https://forum.camunda.io/uploads/default/original/2X/8/8ee361835c572020fbf6b537609cb38c49a75996.png)

2 : Passed both selectBox and default text box but differentiated them in disabled by condition such as  
a : selectBox ` (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class"))`  
b : textBox `(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class"))`

In both the cases the JS code executes well and the same can be seen under group.entries variable inside [camunda\parts\serviceTaskDelegateProps.js](https://github.com/bpmn-io/bpmn-js-properties-panel/blob/354d4ebc845a1e546b91903a7527dc95a1135b8e/lib/provider/camunda/parts/ServiceTaskDelegateProps.js) line#60 but they don’t get reflected on UI.

The Delegate.js code is as under

```
module.exports = function(element, bpmnFactory, options) {

var getImplementationType = options.getImplementationType,
  getBusinessObject = options.getBusinessObject;

var delegateEntrySelect = entryFactory.selectBox({
id: 'delegate',
 label: 'Value',
selectOptions: [
  {value:"one",name:"one"},{value:"two",name:"two"}
],
modelProperty: 'delegate',
emptyParameter: false,

get: function(element, node) {
  var bo = getBusinessObject(element);
  var type = getImplementationType(element);
  var attr = getAttribute(type);
  var label = getDelegationLabel(type);
  return {
    delegate: bo.get(attr),
    delegationLabel: label
  };
},

set: function(element, values, node) {
  var bo = getBusinessObject(element);
  var prop = {};
  prop[attr] = values.delegate || '';
  return cmdHelper.updateBusinessObject(element, bo, prop);
},

validate: function(element, values, node) {
  return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {};
},

disabled: function(element, node) {
  var type = getImplementationType(element);
  console.log("SELECT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class")))
  return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type !== "class"));
}
});   

var delegateEntry = entryFactory.textField({
id: 'delegate',
label: 'Value',
dataValueLabel: 'delegationLabel',
modelProperty: 'delegate',

get: function(element, node) {
  var bo = getBusinessObject(element);
  var type = getImplementationType(element);
  var attr = getAttribute(type);
  var label = getDelegationLabel(type);
  return {
    delegate: bo.get(attr),
    delegationLabel: label
  };
},

set: function(element, values, node) {
  var bo = getBusinessObject(element);
  var type = getImplementationType(element);
  var attr = getAttribute(type);
  var prop = {};
  prop[attr] = values.delegate || '';
  return cmdHelper.updateBusinessObject(element, bo, prop);
},

validate: function(element, values, node) {
  return isDelegate(getImplementationType(element)) && !values.delegate ? { delegate: 'Must provide a value' } : {};
},

disabled: function(element, node) {
  var type = getImplementationType(element);
  console.log("TEXT DISABLE",(!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class")))
  return (!isDelegate(getImplementationType(element)) || (isDelegate(getImplementationType(element)) && type === "class")); 
}  
});

 return [delegateEntrySelect, delegateEntry];
};

```

What I get in output

 ![](https://forum.camunda.io/uploads/default/original/2X/4/4709296324edc0ebf838abdc789fb8c846418c17.png)

Can Someone please help me here.

Thanks

---

<div class="post-metadata">

**Author:** ![Vinodlouis](https://forum.camunda.io/user_avatar/forum.camunda.io/vinodlouis/32/1368_2.png) [@Vinodlouis](https://forum.camunda.io/u/Vinodlouis)\
**Post date:** [March 27, 2017, 2:19pm UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/2 "2017-03-27T14:19:54Z")

</div>

Hi Camunda Team,

Can Anyone please recommend me something here. I’m badly stuck here ☹

---

<div class="post-metadata">

**Author:** ![Vinodlouis](https://forum.camunda.io/user_avatar/forum.camunda.io/vinodlouis/32/1368_2.png) [@Vinodlouis](https://forum.camunda.io/u/Vinodlouis)\
**Post date:** [March 28, 2017, 12:05pm UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/3 "2017-03-28T12:05:18Z")

</div>

Solved it by adding a different file for Select Box as delegateSelect.js adjacent to delegate.js and then in serviceTaskDelegateProps.js registered it as

```
group.entries = group.entries.concat(delegateSelect(element, bpmnFactory, {
    getBusinessObject: getBusinessObject,
    getImplementationType: getImplementationType,
    hideDelegateSelect: function(element, node) {
      console.log(getImplementationType(element) !== 'class',"SELECT")
      return getImplementationType(element) !== 'class';
    }
   }));

  group.entries = group.entries.concat(delegate(element, bpmnFactory, {
    getBusinessObject: getBusinessObject,
    getImplementationType: getImplementationType,
    hideDelegateText: function(element, node) {
      console.log(getImplementationType(element) === 'class',"TEXT")
      return getImplementationType(element) === 'class';
    }
  }));

```

and in respective delegate and delegateSelect handled the disabled as

```
 disabled: function(element, node) {
      if (typeof hideDelegateText === 'function') {
        return hideDelegateText.apply(delegateEntry, arguments);
      }
    }

disabled: function(element, node) {
      if (typeof hideDelegateSelect === 'function') {
        return hideDelegateSelect.apply(delegateEntrySelect, arguments);
      }
    }

```

I referred the [ResultVariable.js](https://github.com/bpmn-io/bpmn-js-properties-panel/blob/354d4ebc845a1e546b91903a7527dc95a1135b8e/lib/provider/camunda/parts/implementation/ResultVariable.js) file to reach this solution

Thanks

---

<div class="post-metadata">

**Author:** ![aakhmerov](https://forum.camunda.io/user_avatar/forum.camunda.io/aakhmerov/32/413_2.png) [@aakhmerov](https://forum.camunda.io/u/aakhmerov)\
**Post date:** [March 29, 2017, 7:57am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/4 "2017-03-29T07:57:03Z")

</div>

Hi @Vinodlouis,

would you be interested in writing a blog post about your implementation?

Cheers,  
Askar

---

<div class="post-metadata">

**Author:** ![Vinodlouis](https://forum.camunda.io/user_avatar/forum.camunda.io/vinodlouis/32/1368_2.png) [@Vinodlouis](https://forum.camunda.io/u/Vinodlouis)\
**Post date:** [March 29, 2017, 8:16am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/5 "2017-03-29T08:16:47Z")

</div>

Hi @aakhmerov

Yeah Sure I would love to share How I implemented it

Thanks

---

<div class="post-metadata">

**Author:** ![aakhmerov](https://forum.camunda.io/user_avatar/forum.camunda.io/aakhmerov/32/413_2.png) [@aakhmerov](https://forum.camunda.io/u/aakhmerov)\
**Post date:** [March 29, 2017, 8:52am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/6 "2017-03-29T08:52:12Z")

</div>

HI @Vinodlouis,

perfect, you would have to prepare a pull request to [https://github.com/camunda/blog.camunda.org](https://github.com/camunda/blog.camunda.org)

in order for it to get published on our blog.

Hope to see your post soon! 🙂

Askar

---

<div class="post-metadata">

**Author:** ![Vinodlouis](https://forum.camunda.io/user_avatar/forum.camunda.io/vinodlouis/32/1368_2.png) [@Vinodlouis](https://forum.camunda.io/u/Vinodlouis)\
**Post date:** [March 31, 2017, 4:29am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/7 "2017-03-31T04:29:26Z")

</div>

Hi @aakhmerov submitted the pull request please have a look at it

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 10:49am UTC](https://forum.camunda.io/t/changes-to-delegate-entries-under-servive-task-for-bpmn-properties-panel-not-getting-updated-on-ui/3171/8 "2024-01-30T10:49:46Z")

</div>

Closed on January 30, 2024, 10:49am UTC


