ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / AssignFeaturesToRecord Method / AssignFeaturesToRecord(ParcelLayer,SelectionSet,ParcelRecord) Method
The parcel fabric layer with the parcels to have the record assigned.
The source layers and feature OIDs of parcel features.
The parcel record that will be assigned to parcel features.
Example Version

AssignFeaturesToRecord(ParcelLayer,SelectionSet,ParcelRecord) Method
Assign parcels to a record.
Syntax

Parameters

parcelLayer
The parcel fabric layer with the parcels to have the record assigned.
sourceFeatures
The source layers and feature OIDs of parcel features.
parcelRecord
The parcel record that will be assigned to parcel features.
Exceptions
ExceptionDescription
ParcelLayer, sourceFeatures, parcelRecord cannot be null.
Insufficient license. This method requires a standard license.
Example
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.");
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also