Although there is no specific "new record" flag, you can test for the existence of the IMPORTID value as this will indicate that the record is not new if it exists, and new if it does not. The IMPORTID is only added after the record is saved. The sample code below shows one example of adding a vendor attribute only to new records. 

'This procedure will be called before a record of the specified type is saved
Public Sub APVendor_BeforeSave(oRecord As Object, bCancel As Boolean)
    'oRecord              : record object being saved
    'bCancel              : set to true to cancel the save operation
    'It will only add an attribute to new vendor records and will NOT update any existing records

    Dim oAPVendor As cAPVendor
    On Error GoTo ErrHandler
    Set oAPVendor = oRecord
    
    ''Since the IMPORTID does not exist while creating a new vendor record, then add attribute
    If Len(oAPVendor.Fields(APVENDORS_fld_IMPORTID)) = 0 Then
    MsgBox "Adding attribute to new vendor record..."
    
        If Not oAPVendor Is Nothing Then
        With oAPVendor.Attributes.Add
         .Fields(Attribute_fld_ATTRIBUTETYPESID) = 9 ''Employee ID - Attribute Type - Values stored in AP7ATTRIBUTETYPES table
         .Fields(Attribute_fld_SEQUENCE) = 1 ''List first in grid
         .Fields(Attribute_fld_VALUE) = "Attribute Description"
         .Fields(Attribute_fld_ATTRIBUTEDATE) = Now()
        .Fields(Attribute_fld_COMMENTS) = "Attribute comments"
        End With

        End If ''If Vendor record is open
    Else
        MsgBox "Vendor record is not new, skipping attribute...."
    End If ''If Vendor Import Id does not exist, hence a new record is being created

    Set oAPVendor = Nothing
    On Error GoTo 0
    Exit Sub

ErrHandler:
    Dim sErr As String
    sErr = Err.Description
    On Error GoTo 0
    '< place your custom error handling code here >
    MsgBox "Error processing APVendor_BeforeSave : " & sErr

    Set oAPVendor = Nothing
    bCancel = False

    Exit Sub

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.