CreateLookupResourceDefinition

ExtendedAttributeDefinition.CreateLookupResourceDefinition 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 Resources only. You are required to specify fieldId and alias when call this method. The field type is inferred from field id.

public static ExtendedAttributeDefinition CreateLookupResourceDefinition(
    ExtendedAttributeResource fieldId, string alias)
Parameter Type Description
fieldId ExtendedAttributeResource The specified ExtendedAttributeResource 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 resource with lookup and then fill it with text values:

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

See Also


ExtendedAttributeDefinition.CreateLookupResourceDefinition 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 Resources only. You are required to specify customFieldType, fieldId and alias when call this method.

public static ExtendedAttributeDefinition CreateLookupResourceDefinition(
    CustomFieldType customFieldType, ExtendedAttributeResource fieldId, string alias)
Parameter Type Description
customFieldType CustomFieldType The specified CustomFieldType type.
fieldId ExtendedAttributeResource The specified ExtendedAttributeResource 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 resource with lookup and then fill it with text values:

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

See Also