Add More Values to Duration(Drop-Down) In MS-CRM 4.0 Task Entity
Posted by Ali Khan on January 24, 2010
In this small post, i will show you how to add more options(Values) to the Standard “Duration” drop-down in the “Task” Entity. So, out of the box, the “Duration” field on the “Task” entity look like this.
Note:- “Duration” Field is not a MS CRM Pick-List. It is editable and user can add anything e.g. “4 Days”, “52 Minutes” etc. In fact the data type of the “Duration” field is “Integer”. but in Task entity it looks like a Standard MS CRM Pick list. In-Background MS CRM is generating a table for this field and displaying the values in the drop-down. See the attribute description below:-
So to add more values to the “Duration” drop-down, put the following JavaScript code in the Task Entity Form ==> OnLoad() event, save the form and publish the “Task” entity. The code is simply adding rows to the table, which is used to display the “Duration” drop-down on “Task” Entity Form.
var obj = document.getElementById('actualdurationminutesSelect');var tbl = obj.childNodes[1];
var lastRow = tbl.rows.length;var row = tbl.insertRow(lastRow);
var cell = row.insertCell(0);
cell.val = '4 days';cell.innerText = '4 days';lastRow++;row = tbl.insertRow(lastRow);var cell = row.insertCell(0);
cell.val = '5 days';cell.innerText = '5 days';After publishing the “Task” entity, the “Duration” drop-down now look like this, with values “4 days” & “5 days” coming inside the default drop-down.
That’s all folks !!!
cherie said
Great post – how would you delete some of the predefined values for Duration(Drop-Down) In MS-CRM 4.0 though – I would like to delete 1 day, 2 days and 3 days from the list.
Bill Marsden said
Hi Muhammad. Oddly, I couldnt get this to work even though I followed the instructions above exactly. I am new to CRM and was interested to see this work but it didnt for me. Any thoughts?
Bill Marsden
Vicente said
Very good post, would it be possible to do the same with the duration of the Service Entity. The problem is that it is a system entity. Is it possible to edit a system entity?