Page 8012 Service Object Attr. Factbox

Subscription Billing, Microsoft.SubscriptionBilling

src/Apps/W1/Subscription Billing/App/Service Objects/Pages/ServiceObjectAttrFactbox.Page.al129 lines, Copyright (c) Microsoft Corporation. MIT

namespace Microsoft.SubscriptionBilling;using Microsoft.Inventory.Item.Attribute;using System.Environment;page 8012 "Service Object Attr. Factbox"{    Caption = 'Subscription Attributes';    DeleteAllowed = false;    InsertAllowed = false;    ModifyAllowed = false;    PageType = ListPart;    RefreshOnActivate = true;    SourceTable = "Item Attribute Value";    SourceTableTemporary = true;    layout    {        area(content)        {            repeater(Control2)            {                ShowCaption = false;                field(Attribute; Rec.GetAttributeNameInCurrentLanguage())                {                    ApplicationArea = Basic, Suite;                    Caption = 'Attribute';                    ToolTip = 'Specifies the name of the Subscription attribute.';                    Visible = TranslatedValuesVisible;                }                field(Value; Rec.GetValueInCurrentLanguage())                {                    ApplicationArea = Basic, Suite;                    Caption = 'Value';                    ToolTip = 'Specifies the value of the Subscription attribute.';                    Visible = TranslatedValuesVisible;                }                field("Attribute Name"; Rec."Attribute Name")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Attribute';                    ToolTip = 'Specifies the name of the Subscription attribute.';                    Visible = not TranslatedValuesVisible;                }                field(RawValue; Rec.Value)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Value';                    ToolTip = 'Specifies the value of the Subscription attribute.';                    Visible = not TranslatedValuesVisible;                }            }        }    }    actions    {        area(processing)        {            action(Edit)            {                AccessByPermission = tabledata "Item Attribute" = R;                ApplicationArea = Basic, Suite;                Caption = 'Edit';                Image = Edit;                ToolTip = 'Edit the Subscription''s attributes that describe it in more detail.';                trigger OnAction()                var                    ServiceObject: Record "Subscription Header";                begin                    if not ServiceObject.Get(ServiceObjectNo) then                        exit;                    Page.RunModal(Page::"Serv. Object Attr. Values", ServiceObject);                    CurrPage.SaveRecord();                    LoadServiceObjectAttributesData(ServiceObjectNo);                end;            }        }    }    trigger OnOpenPage()    begin        Rec.SetAutoCalcFields("Attribute Name");        TranslatedValuesVisible := ClientTypeManagement.GetCurrentClientType() <> ClientType::Phone;        if ServiceObjectNo <> '' then            LoadServiceObjectAttributesData(ServiceObjectNo);    end;    var        ClientTypeManagement: Codeunit "Client Type Management";        ServiceObjectNo: Code[20];    protected var        TranslatedValuesVisible: Boolean;    procedure LoadServiceObjectAttributesData(KeyValue: Code[20])    begin        ServiceObjectNo := KeyValue;        LoadServiceObjectAttributesFactBoxData(KeyValue);        CurrPage.Update(false);    end;    procedure LoadServiceObjectAttributesFactBoxData(KeyValue: Code[20])    var        ItemAttributeValueMapping: Record "Item Attribute Value Mapping";        ItemAttributeValue: Record "Item Attribute Value";    begin        Rec.Reset();        Rec.DeleteAll(false);        ItemAttributeValueMapping.SetRange("Table ID", Database::"Subscription Header");        ItemAttributeValueMapping.SetRange("No.", KeyValue);        if ItemAttributeValueMapping.FindSet() then            repeat                if ItemAttributeValue.Get(ItemAttributeValueMapping."Item Attribute ID", ItemAttributeValueMapping."Item Attribute Value ID") then begin                    Rec.TransferFields(ItemAttributeValue);                    OnLoadItemAttributesFactBoxDataOnBeforeInsert(ItemAttributeValueMapping, Rec);                    Rec.Insert(false);                end            until ItemAttributeValueMapping.Next() = 0;    end;    [IntegrationEvent(false, false)]    local procedure OnLoadItemAttributesFactBoxDataOnBeforeInsert(var ItemAttributeValueMapping: Record "Item Attribute Value Mapping"; var ItemAttributeValue: Record "Item Attribute Value")    begin    end;}