ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ParcelFabricExtensions Class / SetActiveRecordAsync Method / SetActiveRecordAsync(ParcelLayer,Int64) Method
The parcel layer.
The object Id of the parcel record feature to be set as the current record.
Example

In This Topic
    SetActiveRecordAsync(ParcelLayer,Int64) Method
    In This Topic
    Sets the active record.
    Syntax
    Public Overloads Shared Function SetActiveRecordAsync( _
       ByVal parcelLayer As ParcelLayer, _
       ByVal oid As Long _
    ) As Task(Of Boolean)
    public static Task<bool> SetActiveRecordAsync( 
       ParcelLayer parcelLayer,
       long oid
    )

    Parameters

    parcelLayer
    The parcel layer.
    oid
    The object Id of the parcel record feature to be set as the current record.

    Return Value

    A Task to a bool indicating if the active record is set.
    Exceptions
    ExceptionDescription
    Insufficient license. This method requires a standard license.
    Remarks
    All clients, including the parcel heads-up-display on the active map, will be notified and use the values given. Values for the parcel record must be set correctly to match the underlying data.
    Example
    Create a new record
    {
      string errorMessage = await QueuedTask.Run(async () =>
    {
      Dictionary<string, object> RecordAttributes = [];
      string sNewRecord = "MyRecordName";
      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 recordsLayer = await myParcelFabricLayer.GetRecordsLayerAsync();
        var editOper = new EditOperation()
        {
          Name = "Create Parcel Fabric Record",
          ProgressMessage = "Create Parcel Fabric Record...",
          ShowModalMessageAfterFailure = true,
          SelectNewFeatures = false,
          SelectModifiedFeatures = false
        };
        RecordAttributes.Add("Name", sNewRecord);
        var editRowToken = editOper.Create(recordsLayer.FirstOrDefault(), RecordAttributes);
        if (!editOper.Execute())
          return editOper.ErrorMessage;
    
        var defOID = -1;
        var lOid = editRowToken.ObjectID ?? defOID;
        await myParcelFabricLayer.SetActiveRecordAsync(lOid);
      }
      catch (Exception ex)
      {
        return ex.Message;
      }
      return "";
    });
      if (!string.IsNullOrEmpty(errorMessage))
        MessageBox.Show(errorMessage, "Create New Record.");
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also