We have prepared hotfix verison for
TASKS-34571 that you can download from
here. Please note that we have made some improvements for working with Extended Attributes for simplification purpose. Some examples for working with the simplified implementation are as follow:
Creating Custom Text Attribute and Adding to Task
var taskExtendedAttributeText9Definition = ExtendedAttributeDefinition.CreateTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text9, “Task City Name”);
proj.ExtendedAttributes.Add(taskExtendedAttributeText9Definition);
var task = proj.RootTask.Children.Add(“Task 1”);
var taskExtendedAttributeText9 = taskExtendedAttributeText9Definition.CreateExtendedAttribute();
taskExtendedAttributeText9.Value = “London”;
task.ExtendedAttributes.Add(taskExtendedAttributeText9);
Creating Custom Text Attribute with Lookup Table
var taskExtendedAttributeText9Definition = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text9, “Task City Name”);
taskExtendedAttributeText9Definition.AddLookupValue(new Value { Id = 1, StringValue = “Value1”, Description = “This is Value1” });
taskExtendedAttributeText9Definition.AddLookupValue(new Value { Id = 2, StringValue = “Value2”, Description = “This is Value2” });
proj.ExtendedAttributes.Add(taskExtendedAttributeText9Definition);
var task = proj.RootTask.Children.Add(“Task 1”);
var taskExtendedAttributeText9 = taskExtendedAttributeText9Definition.CreateExtendedAttribute(taskExtendedAttributeText9Definition.ValueList[1]);
task.ExtendedAttributes.Add(taskExtendedAttributeText9);
Creating Custom Duration Attribute with Lookup Table
var taskExtendedAttributeDuration2Definition = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Duration,
ExtendedAttributeTask.Duration2,
“Some duration”);
taskExtendedAttributeDuration2Definition.AddLookupValue(new Value { Id = 2, DurationValue = 4 * 60, Description = “4 hours” });
taskExtendedAttributeDuration2Definition.AddLookupValue(new Value { Id = 3, DurationValue = 8 * 60, Description = “1 day” });
taskExtendedAttributeDuration2Definition.AddLookupValue(new Value { Id = 4, DurationValue = 1 * 60, Description = “1 hour” });
taskExtendedAttributeDuration2Definition.AddLookupValue(new Value { Id = 7, DurationValue = 10 * 8 * 60, Description = “10 days” });
proj.ExtendedAttributes.Add(taskExtendedAttributeDuration2Definition);
var task = proj.RootTask.Children.Add(“Task 1”);
var taskExtendedAttributeDuration2 = taskExtendedAttributeDuration2Definition.CreateExtendedAttribute(taskExtendedAttributeDuration2Definition.ValueList[3]);
task.ExtendedAttributes.Add(taskExtendedAttributeDuration2);
Note: Currently (16.11.1 version) duration attributes can’t be saved to XML and read by MSP. There is a bug in MSP that causes this behavior.
Creating Custom DateTime Attribute with Lookup Table
var taskExtendedAttributeFinish2Definition = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Finish,
ExtendedAttributeTask.Finish2,
“Some finish”);
taskExtendedAttributeFinish2Definition.AddLookupValue(new Value { Id = 2, DateTimeValue = new DateTime(1984, 01, 01, 00, 00, 01), Description = “This is Value2” });
taskExtendedAttributeFinish2Definition.AddLookupValue(new Value { Id = 3, DateTimeValue = new DateTime(1994, 01, 01, 00, 01, 01), Description = “This is Value3” });
taskExtendedAttributeFinish2Definition.AddLookupValue(new Value { Id = 4, DateTimeValue = new DateTime(2009, 12, 31, 00, 00, 00), Description = “This is Value4” });
taskExtendedAttributeFinish2Definition.AddLookupValue(new Value { Id = 7, DateTimeValue = DateTime.Now, Description = “This is Value6” });
proj.ExtendedAttributes.Add(taskExtendedAttributeFinish2Definition);
var task = proj.RootTask.Children.Add(“Task 1”);
var taskExtendedAttributeFinish2 = taskExtendedAttributeFinish2Definition.CreateExtendedAttribute(taskExtendedAttributeFinish2Definition.ValueList[3]);
task.ExtendedAttributes.Add(taskExtendedAttributeFinish2);