Create a decimal attribute

// ** Create a decimal attribute **   

DecimalAttributeMetadata decimalAttribute = new DecimalAttributeMetadata

{

    // Set base properties

    SchemaName = "new_decimal",

    DisplayName = new Label("Sample Decimal", 1033),

    RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),

    Description = new Label("Decimal Attribute", 1033),

    // Set extended properties

    MaxValue = 100,

    MinValue = 0,

    Precision = 1

};

 

 

 

// Create the request.

CreateAttributeRequest createAttributeRequest = new CreateAttributeRequest

{

    EntityName = "EntityLogicalName",

    Attribute = decimalAttribute

};

 

// Execute the request. Get Response

CreateAttributeResponse resp = (CreateAttributeResponse)_service.Execute(createAttributeRequest);