ArcGIS Pro 3.1 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 static Task<bool> SetActiveRecordAsync( 
       ParcelLayer parcelLayer,
       long oid
    )
    Public Overloads Shared Function SetActiveRecordAsync( _
       ByVal parcelLayer As ParcelLayer, _
       ByVal oid As Long _
    ) As Task(Of Boolean)

    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 = new Dictionary<string, object>();
      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.HasValue ? editRowToken.ObjectID.Value : 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, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also