ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Attribute.ValidationError Structure / Create Method
Description of the error.
Severity of the error.
Example

In This Topic
    Create Method (Attribute.ValidationError)
    In This Topic
    Creates a new ValidationError.
    Syntax
    Public Shared Function Create( _
       ByVal desc As String, _
       ByVal severity As Severity _
    ) As Attribute.ValidationError

    Parameters

    desc
    Description of the error.
    severity
    Severity of the error.

    Return Value

    The new validation error.
    Example
    Inspector.AddValidate
    // Adds a custom validation rule to the "Mineral" field of the specified feature layer.
    await QueuedTask.Run(() =>
    {
      var insp = new Inspector();
      insp.LoadSchema(featureLayer);
      var attrib = insp.Where(a => a.FieldName == "Mineral").First();
      attrib.AddValidate(() =>
      {
        if (attrib.CurrentValue.ToString() == "Salt")
          return [];
        else return [ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError.Create("Error", Severity.Low)];
      });
    });
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also