ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ParcelFabricExtensions Class / GetActiveRecord Method
The parcel layer.
Example

In This Topic
    GetActiveRecord Method
    In This Topic
    Gets the active record information.
    Syntax
    public static ParcelRecord GetActiveRecord( 
       ParcelLayer parcelLayer
    )
    Public Shared Function GetActiveRecord( _
       ByVal parcelLayer As ParcelLayer _
    ) As ParcelRecord

    Parameters

    parcelLayer
    The parcel layer.

    Return Value

    Exceptions
    ExceptionDescription
    Insufficient license. This method requires a standard license.
    Example
    Get the active record
    string errorMessage = await QueuedTask.Run(() =>
    {
      try
      {
        var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
        //if there is no fabric in the map then bail
        if (myParcelFabricLayer == null)
          return "There is no fabric in the map.";
        var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
        if (theActiveRecord == null)
          return "There is no Active Record. Please set the active record and try again.";
      }
      catch (Exception ex)
      {
        return ex.Message;
      }
      return "";
    });
    if (!string.IsNullOrEmpty(errorMessage))
      MessageBox.Show(errorMessage, "Get Active Record.");
    Assign features to active record
     string errorMessage = await QueuedTask.Run(() =>
    {
       //check for selected layer
       if (MapView.Active.GetSelectedLayers().Count == 0)
        return "Please select a source feature layer in the table of contents.";
       //first get the feature layer that's selected in the table of contents
       var srcFeatLyr = MapView.Active.GetSelectedLayers().OfType<FeatureLayer>().FirstOrDefault();
      var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
      if (myParcelFabricLayer == null)
        return "No parcel layer found in the map.";
      try
      {
        var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
        if (theActiveRecord == null)
          return "There is no Active Record. Please set the active record and try again.";
        var editOper = new EditOperation()
        {
          Name = "Assign Features to Record",
          ProgressMessage = "Assign Features to Record...",
          ShowModalMessageAfterFailure = true,
          SelectNewFeatures = true,
          SelectModifiedFeatures = false
        };
         //add parcel type layers and their feature ids to a new Dictionary
         var ids = new List<long>(srcFeatLyr.GetSelection().GetObjectIDs());
        var sourceFeatures = new Dictionary<MapMember, List<long>>();
        sourceFeatures.Add(srcFeatLyr, ids);
        editOper.AssignFeaturesToRecord(myParcelFabricLayer,
          SelectionSet.FromDictionary(sourceFeatures), theActiveRecord);
        if (!editOper.Execute())
          return editOper.ErrorMessage;
      }
      catch (Exception ex)
      {
        return ex.Message;
      }
      return "";
    });
     if (!string.IsNullOrEmpty(errorMessage))
       MessageBox.Show(errorMessage, "Assign Features To Record.");
    Create parcel seeds
     try
    {
      var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
      if (theActiveRecord == null)
        return "There is no Active Record. Please set the active record and try again.";
    
      var guid = theActiveRecord.Guid;
      var editOper = new EditOperation()
      {
        Name = "Create Parcel Seeds",
        ProgressMessage = "Create Parcel Seeds...",
        ShowModalMessageAfterFailure = true,
        SelectNewFeatures = true,
        SelectModifiedFeatures = false
      };
      editOper.CreateParcelSeedsByRecord(myParcelFabricLayer, guid, MapView.Active.Extent);
      if (!editOper.Execute())
        return editOper.ErrorMessage;
    }
    catch (Exception ex)
    {
      return ex.Message;
    }
    return "";
    Build parcels
     try
    {
      var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
      if (myParcelFabricLayer == null)
        return "Parcel layer not found in map.";
    
      var theActiveRecord = myParcelFabricLayer.GetActiveRecord();
      var guid = theActiveRecord.Guid;
      var editOper = new EditOperation()
      {
        Name = "Build Parcels",
        ProgressMessage = "Build Parcels...",
        ShowModalMessageAfterFailure = true,
        SelectNewFeatures = true,
        SelectModifiedFeatures = true
      };
      editOper.BuildParcelsByRecord(myParcelFabricLayer, guid);
      if (!editOper.Execute())
        return editOper.ErrorMessage;
    }
    catch (Exception ex)
    {
      return ex.Message;
    }
    return "";
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also