CreateLookupTaskDefinition

ExtendedAttributeDefinition.CreateLookupTaskDefinition method (1 of 2)

Factory method which creates an extended attribute definition with lookup. It has CalculationType equals to Lookup and can be used in Tasks only. You are required to specify fieldId and alias when call this method. The field type is inferred from field id.

public static ExtendedAttributeDefinition CreateLookupTaskDefinition(ExtendedAttributeTask fieldId, 
    string alias)
Parameter Type Description
fieldId ExtendedAttributeTask The specified ExtendedAttributeTask field ID.
alias String The specified String alias.

Return Value

Created instance of the ExtendedAttributeDefinition class with specified fieldId and alias.

Examples

Use this example to create a custom field definition for a task with lookup and then fill it with text values:

var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);

See Also


ExtendedAttributeDefinition.CreateLookupTaskDefinition method (2 of 2)

Factory method which creates an extended attribute definition with lookup. It has CalculationType equals to Lookup and can be used in Tasks only. You are required to specify customFieldType, fieldId and alias when call this method.

public static ExtendedAttributeDefinition CreateLookupTaskDefinition(
    CustomFieldType customFieldType, ExtendedAttributeTask fieldId, string alias)
Parameter Type Description
customFieldType CustomFieldType The specified CustomFieldType type.
fieldId ExtendedAttributeTask The specified ExtendedAttributeTask field ID.
alias String The specified String alias.

Return Value

Created instance of the ExtendedAttributeDefinition class with specified customFieldType, fieldId and alias.

Examples

Use this example to create a custom field definition for a task with lookup and then fill it with text values:

var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);

See Also