page 57700 "DWApiCustomersGet" { APIVersion = 'v2.0'; EntityCaption = 'DW Customer'; EntitySetCaption = 'DW Customers'; ChangeTrackingAllowed = true; DelayedInsert = true; EntityName = 'dwcustomer'; EntitySetName = 'dwcustomers'; ODataKeyFields = SystemId; PageType = API; APIPublisher = 'Dynamicweb'; APIGroup = 'Dynamicweb'; SourceTable = Customer; Extensible = false; Caption = 'Dynamicweb API Customers Page'; Permissions = TableData "Customer" = rimd; layout { area(content) { repeater(Group) { field(id; Rec.SystemId) { Caption = 'Id'; Editable = false; } field(AccessUserExternalId; Rec."No.") { Caption = 'No.'; } field(AccessUserUserName; Rec."No.") { Caption = 'AccessUserUserName (calculated)'; } field(LocationCode; Rec."Location Code") { Caption = 'Location code'; } field(AccessUser_PriceGroup; Rec."Customer Price Group") { Caption = 'Customer Price group'; } field(AccessUser_CreditLimit; (Rec."Credit Limit (LCY)" - Rec.Balance)) { Caption = 'Credit Limit (LCY)'; } field(AccessUserName; Rec."Name 2") { Caption = 'Name 2'; ShowMandatory = true; } field(Type; Rec."Contact Type") { Caption = 'Contact type'; } field(AccessUserAddress; Rec.Address) { Caption = 'Address'; } field(AccessUserAddress2; Rec."Address 2") { Caption = 'Address 2'; } field(AccessUserCity; Rec.City) { Caption = 'City'; } field(AccessUserState; Rec.County) { Caption = 'County'; } field(AccessUserCountryCode; CountryCode) { Caption = 'Country/Region Code'; } field(AccessUserCountryName; CountryRegion.Name) { Caption = 'Country/Region Name'; } field(AccessUserZip; Rec."Post Code") { Caption = 'Post Code'; } field(AccessUserPhone; Rec."Phone No.") { Caption = 'Phone No.'; } field(AccessUserEmail; Rec."E-Mail") { Caption = 'E-Mail'; } field(Website; Rec."Home Page") { Caption = 'Home page'; } field(AccessUser_TaxLiable; Rec."Tax Liable") { Caption = 'Tax Liable'; } field(TaxAreaId; TaxArea."Code") { Caption = '"Tax Area".Code'; } field(TaxAreaDisplayName; TaxAreaDisplayNameGlobal) { Caption = 'TaxAreaDisplayNameGlobal (calculated)'; Editable = false; } field(TaxRegistrationNumber; Rec."VAT Registration No.") { Caption = 'VAT registration no.'; } field(CurrencyId; Rec."Currency Id") { Caption = 'Currency Id'; } field(CurrencyCode; CurrencyCodeTxt) { Caption = 'CurrencyCodeTxt (calc)'; } field(AccessUser_PaymentTerms; PaymentTerms.Code) { Caption = '"Payment Terms".Code'; } field(AccessUser_ShippingMethod; ShipmentMethod.Code) { Caption = '"Shipment Method".Code'; } field(AccessUser_PaymentMethod; PaymentMethod.Code) { Caption = '"Payment Method".Code'; } field(Blocked; Rec.Blocked) { Caption = 'Blocked'; } field(AccessUser_DeliveryInstructions; DeliveryInstructions) { Caption = '"WC WI Delivery Instructions"'; } field(AccessUser_DisallowOrdering; AccessUser_DisallowOrdering) { Caption = 'Accessuser_DisallowOrder (calculated)'; } field(AccessUser_AllowOnAccount; AccessUser_AllowOnAccount) { Caption = 'AccessUser_AllowOnAccount (calculated)'; } field(AccessUserActive; AccessUserActive) { Caption = 'AccessUserActive (calc)'; } field(AccessUser_AssignedSalesRepId; Salesperson.Name + '(' + Salesperson.Code + ')' + '') { Caption = 'AccessUserActive (calc)'; } field(LastModifiedDateTime; Rec.SystemModifiedAt) { Caption = 'SystemModifiedAt'; } field(CustDiscGroup; Rec."Customer Disc. Group") { Caption = 'Customer disc. group'; } field(CurrRecTimeStamp; CurrRecTimeStamp) { Caption = 'CurrRecTimeStamp'; } field(GenBusPostingGroup; Rec."Gen. Bus. Posting Group") { Caption = '"Gen. Bus. Posting Group"'; } } } } actions { } trigger OnOpenPage() var begin case CompanyName of 'Wilson Daniels National': //B2C begin Rec.SetRange("Gen. Bus. Posting Group", 'Private Client'); Rec.SetFilter("WC DW100 Web Customer", 'Yes'); end; end; end; trigger OnAfterGetRecord() begin SetCalculatedFields(); end; trigger OnAfterGetCurrRecord() var RecRef: RecordRef; begin Clear(RecRef); RecRef.GetTable(Rec); CurrRecTimeStamp := RecRef.Field(0).Value; AccessUserUserName := 'Customer_' + Rec."No."; if Rec."WC DW100-2 Can Place DW Orders" then AccessUser_DisallowOrdering := 'False' else AccessUser_DisallowOrdering := 'True'; if (Rec.Blocked = Rec.Blocked::" ") and (Rec."WC DW100 Web Customer") then AccessUserActive := 'True' else AccessUserActive := 'False'; if (TaxArea.GET(Rec."Tax Area Code")) then; if (PaymentTerms.Get(Rec."Payment Terms Code")) then; if (ShipmentMethod.Get(Rec."Shipment Method Code")) then; if (PaymentMethod.Get(Rec."Payment Method Code")) then; if (CountryRegion.Get(Rec."Country/Region Code")) then CountryCode := CountryRegion."ISO Code"; if Rec."Payment Terms Code" = '' then AccessUser_AllowOnAccount := 'false' else AccessUser_AllowOnAccount := 'true'; Rec.CalcFields(Rec."WC WI Delivery Instructions"); Rec."WC WI Delivery Instructions".CreateInStream(DeliveryInstructionsInStream); DeliveryInstructionsInStream.Read(DeliveryInstructions); if Salesperson.Get(Rec."Salesperson Code") then; end; var Currency: Record Currency; PaymentTerms: Record "Payment Terms"; ShipmentMethod: Record "Shipment Method"; PaymentMethod: Record "Payment Method"; //TempFieldSet: Record 2000000041 temporary; TaxArea: Record "Tax Area"; //DeliveryInstructions: Record "WC WI Delivery Instructions"; ContactBusinessRelation: Record "Contact Business Relation"; ContactTable: Record Contact; CountryRegion: Record "Country/Region"; Salesperson: Record "Salesperson/Purchaser"; GraphMgtGeneralTools: Codeunit "Graph Mgt - General Tools"; LCYCurrencyCode: Code[10]; CurrencyCodeTxt: Text; TaxAreaDisplayNameGlobal: Text; CurrRecTimeStamp: BigInteger; BlankGUID: Guid; AccessUserUserName: Text; AccessUserActive: Text; AccessUser_DisallowOrdering: Text; AccessUser_AllowOnAccount: Text; DeliveryInstructions: Text; CountryCode: Text; DeliveryInstructionsInStream: InStream; CurrencyValuesDontMatchErr: Label 'The currency values do not match to a specific Currency.'; CurrencyIdDoesNotMatchACurrencyErr: Label 'The "currencyId" does not match to a Currency.', Comment = 'currencyId is a field name and should not be translated.'; CurrencyCodeDoesNotMatchACurrencyErr: Label 'The "currencyCode" does not match to a Currency.', Comment = 'currencyCode is a field name and should not be translated.'; PaymentTermsIdDoesNotMatchAPaymentTermsErr: Label 'The "paymentTermsId" does not match to a Payment Terms.', Comment = 'paymentTermsId is a field name and should not be translated.'; ShipmentMethodIdDoesNotMatchAShipmentMethodErr: Label 'The "shipmentMethodId" does not match to a Shipment Method.', Comment = 'shipmentMethodId is a field name and should not be translated.'; PaymentMethodIdDoesNotMatchAPaymentMethodErr: Label 'The "paymentMethodId" does not match to a Payment Method.', Comment = 'paymentMethodId is a field name and should not be translated.'; NotProvidedCustomerNameErr: Label 'A "displayName" must be provided.', Comment = 'displayName is a field name and should not be translated.'; BlankCustomerNameErr: Label 'The blank "displayName" is not allowed.', Comment = 'displayName is a field name and should not be translated.'; local procedure SetCalculatedFields() var TaxAreaBuffer: Record "Tax Area Buffer"; begin CurrencyCodeTxt := GraphMgtGeneralTools.TranslateNAVCurrencyCodeToCurrencyCode(LCYCurrencyCode, Rec."Currency Code"); TaxAreaDisplayNameGlobal := TaxAreaBuffer.GetTaxAreaDisplayName(Rec."Tax Area ID"); end; }