Table 9151 My Vendor, source in 29

Source29

src/Layers/W1/BaseApp/Purchases/Vendor/MyVendor.Table.al89 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Purchases.Vendor;

using Microsoft.Purchases.Payables;
using System.Security.AccessControl;

table 9151 "My Vendor"
{
    Caption = 'My Vendor';
    DataClassification = CustomerContent;

    fields
    {
        field(1; "User ID"; Code[50])
        {
            Caption = 'User ID';
            DataClassification = EndUserIdentifiableInformation;
            TableRelation = User."User Name";
            ValidateTableRelation = false;
        }
        field(2; "Vendor No."; Code[20])
        {
            Caption = 'Vendor No.';
            ToolTip = 'Specifies the vendor numbers that are displayed in the My Vendor Cue on the Role Center.';
            NotBlank = true;
            TableRelation = Vendor;

            trigger OnValidate()
            begin
                SetVendorFields();
            end;
        }
        field(3; Name; Text[100])
        {
            Caption = 'Name';
            ToolTip = 'Specifies the name of the record.';
            Editable = false;
        }
        field(4; "Phone No."; Text[30])
        {
            Caption = 'Phone No.';
            ToolTip = 'Specifies the vendor''s phone number.';
            Editable = false;
        }
        field(5; "Balance (LCY)"; Decimal)
        {
            AutoFormatType = 1;
            AutoFormatExpression = '';
            CalcFormula = - sum("Detailed Vendor Ledg. Entry"."Amount (LCY)" where("Vendor No." = field("Vendor No.")));
            Caption = 'Balance (LCY)';
            Editable = false;
            FieldClass = FlowField;
        }
    }

    keys
    {
        key(Key1; "User ID", "Vendor No.")
        {
            Clustered = true;
        }
        key(Key2; Name)
        {
        }
        key(Key3; "Phone No.")
        {
        }
    }

    fieldgroups
    {
    }

    procedure SetVendorFields()
    var
        Vendor: Record Vendor;
    begin
        Vendor.SetLoadFields("Name", "Phone No.");
        if Vendor.Get("Vendor No.") then begin
            Name := Vendor.Name;
            "Phone No." := Vendor."Phone No.";
        end;
    end;
}