OBJECT Codeunit 50011 NavXtenderAddLink
{
  OBJECT-PROPERTIES
  {
    Date=11/22/17;
    Time=11:08:24 AM;
    Modified=Yes;
    Version List=IW17.11;
  }
  PROPERTIES
  {
    OnRun=VAR
            ltxtServiceURL@1000000002 : Text;
            ltcServiceName@1000000007 : TextConst 'ENU=NavXtender';
            ltcSoapURL@1000000006 : TextConst 'ENU=Soap Url: %1';
            ltcServiceInstalledMessage@1000000005 : TextConst 'ENU=Web service created. Copy with Ctrl+C. Paste this link into the web service section of the NavXtender Configuration:\\%1';
            lrecWebService@1000000000 : Record 2000000076;
            ltcServiceInstalledMessage2013@1000000001 : TextConst 'ENU=Web service installed. Please obtain SOAP URL and update the NavXtender configuration with it.';
          BEGIN
            //<IW >
            //  Creates the web service. Used when codeunit is first imported.
            //</IW>

            lrecWebService.VALIDATE("Object Type", lrecWebService."Object Type"::Codeunit);
            lrecWebService."Service Name" := ltcServiceName;
            lrecWebService."Object ID" := CODEUNIT::NavXtenderAddLink;
            lrecWebService.VALIDATE(Published, TRUE);
            lrecWebService.INSERT(TRUE);

            // uncomment this for NAV2013R2 and up:
            ltxtServiceURL := GETURL(CLIENTTYPE::SOAP,COMPANYNAME,OBJECTTYPE::Codeunit,CODEUNIT::NavXtenderAddLink);

            IF GUIALLOWED THEN
              IF ltxtServiceURL = '' THEN
                MESSAGE(ltcServiceInstalledMessage2013)
              ELSE
                MESSAGE(ltcServiceInstalledMessage, ltxtServiceURL);
          END;

  }
  CODE
  {
    VAR
      ltcGLAccountCard@1000000001 : TextConst 'ENU=G/L Account Card;ESM=Ficha cuenta;FRC=Fiche compte GL;ENC=G/L Account Card';
      ltcCustomerCard@1000000002 : TextConst 'ENU=Customer Card;ESM=Ficha cliente;FRC=Fiche client;ENC=Customer Card';
      ltcVendorCard@1000000003 : TextConst 'ENU=Vendor Card;ESM=Ficha proveedor;FRC=Fiche fournisseur;ENC=Vendor Card';
      ltcItemCard@1000000004 : TextConst 'ENU=Item Card;ESM=Ficha producto;FRC=Fiche d''article;ENC=Item Card';
      ltcSalesQuote@1000000005 : TextConst 'ENU=Sales Quote;ESM=Cotizacin venta;FRC=Devis;ENC=Sales Quote';
      ltcSalesOrder@1000000006 : TextConst 'ENU=Sales Order;ESM=Pedido venta;FRC=Document de vente;ENC=Sales Order';
      ltcSalesInvoice@1000000007 : TextConst 'ENU=Sales Invoice;ESM=Factura venta;FRC=Facture vente;ENC=Sales Invoice';
      ltcPurchaseQuote@1000000008 : TextConst 'ENU=Purchase Quote;ESM=Cotizacin compra;FRC=Devis d''achat;ENC=Purchase Quote';
      ltcPurchaseOrder@1000000009 : TextConst 'ENU=Purchase Order;ESM=Pedido compra;FRC=Bon de commande;ENC=Purchase Order';
      ltcPurchaseInvoice@1000000010 : TextConst 'ENU=Purchase Invoice;ESM=Factura compra;FRC=Facture achat;ENC=Purchase Invoice';
      ltcResourceCard@1000000011 : TextConst 'ENU=Resource Card;ESM=Ficha recurso;FRC=Fiche ressource;ENC=Resource Card';
      ltcJobCard@1000000012 : TextConst 'ENU=Job Card;ESM=Ficha proyecto;FRC=Fiche projet;ENC=Job Card';
      ltcPostedSalesInvoice@1000000013 : TextConst 'ENU=Posted Sales Invoice;ESM=Histrico facturas venta;FRC=Fact. vente reporte;ENC=Posted Sales Invoice';
      ltcPostedPurchaseInvoice@1000000014 : TextConst 'ENU=Posted Purchase Invoice;ESM=Histico facturas compra;FRC=Facture d''achat reporte;ENC=Posted Purchase Invoice';
      ltcBankAccountCard@1000000015 : TextConst 'ENU=Bank Account Card;ESM=Ficha banco;FRC=Fiche compte bancaire;ENC=Bank Account Card';
      ltcCustomerBankAccountCard@1000000016 : TextConst 'ENU=Customer Bank Account Card;ESM=Ficha banco cliente;FRC=Fiche compte bancaire client;ENC=Customer Bank Account Card';
      ltcVendorBankAccountCard@1000000017 : TextConst 'ENU=Vendor Bank Account Card;ESM=Ficha banco proveedor;FRC=Fiche compte bancaire fournisseur;ENC=Vendor Bank Account Card';
      ltcFinanceChargeTermsCard@1000000018 : TextConst 'ENU=Finance Charge Terms Card;ESM=Ficha trminos inters;FRC=Fiche modalits frais financiers;ENC=Finance Charge Terms Card';
      ltcCurrencyCard@1000000019 : TextConst 'ENU=Currency Card;ESM=Ficha divisa;FRC=Fiche devise;ENC=Currency Card';
      ltcBlanketSalesOrder@1000000020 : TextConst 'ENU=Blanket Sales Order;ESM=Pedido abierto venta;FRC=Commande permanente ventes;ENC=Blanket Sales Order';
      ltcBlanketPurchaseOrder@1000000021 : TextConst 'ENU=Blanket Purchase Order;ESM=Pedido abierto compra;FRC=Commande permanente achats;ENC=Blanket Purchase Order';
      ltcICGLAccountCard@1000000022 : TextConst 'ENU=IC G/L Account Card;ESM=Ficha cuenta IC;FRC=Fiche de compte de grand livre IC;ENC=IC G/L Account Card';
      ltcICPartnerCard@1000000023 : TextConst 'ENU=IC Partner Card;ESM=Ficha socio IC;FRC=Fiche de partenaire IC;ENC=IC Partner Card';
      ltcJobQueueEntryCard@1000000024 : TextConst 'ENU=Job Queue Entry Card;ESM=Ficha mov. cola proyecto;FRC=Fiche criture file d''attente des travaux;ENC=Job Queue Entry Card';
      ltcCashFlowForecastCard@1000000025 : TextConst 'ENU=Cash Flow Forecast Card;ESM=Ficha previsin flujo efectivo;FRC=Fiche Prvision de la trsorerie;ENC=Cash Flow Forecast Card';
      ltcCashFlowAccountCard@1000000026 : TextConst 'ENU=Cash Flow Account Card;ESM=Ficha de cuenta de flujo de caja;FRC=Fiche Compte de trsorerie;ENC=Cash Flow Account Card';
      ltcAssemblyOrder@1000000027 : TextConst 'ENU=Assembly Order;ESM=Pedido de ensamblado;FRC=Ordre d''assemblage;ENC=Assembly Order';
      ltcPostedAssemblyOrder@1000000028 : TextConst 'ENU=Posted Assembly Order;ESM=Pedido de ensamblado registrado;FRC=Ordre d''assemblage report;ENC="Posted Assembly Order  "';
      ltcAssemblyQuote@1000000029 : TextConst 'ENU=Assembly Quote;ESM=Cotizacin de ensamblado;FRC=Devis d''assemblage;ENC=Assembly Quote';
      ltcBlanketAssemblyOrder@1000000030 : TextConst 'ENU=Blanket Assembly Order;ESM=Pedido de ensamblado abierto;FRC=Ordre d''assemblage permanent;ENC=Blanket Assembly Order';
      ltcJobTaskCard@1000000031 : TextConst 'ENU=Job Task Card;ESM=Ficha tarea proyecto;FRC=Filtres de tche de projet;ENC=Job Task Card';
      ltcCostTypeCard@1000000032 : TextConst 'ENU=Cost Type Card;ESM=Ficha tipo costo;FRC=Fiche type de cot;ENC=Cost Type Card';
      ltcCostAllocationTargetCard@1000000033 : TextConst 'ENU=Cost Allocation Target Card;ESM=Ficha destino asig. costos;FRC=Fiche cible de l''affectation des cots;ENC=Cost Allocation Target Card';
      ltcCostCenterCard@1000000034 : TextConst 'ENU=Cost Center Card;ESM=Ficha centro de costo;FRC=Fiche centre de cots;ENC=Cost Centre Card';
      ltcCostObjectCard@1000000035 : TextConst 'ENU=Cost Object Card;ESM=Ficha objeto de costo;FRC=Fiche objet de cots;ENC=Cost Object Card';
      ltcDataExchDefCard@1000000036 : TextConst 'ENU=Data Exchange Definition;ESM=Definicin de intercambio de datos;FRC=Dfinition d''change de donnes;ENC=Data Exchange Definition';
      ltcDataExchLineDefCard@1000000037 : TextConst 'ENU=Line Definitions;ESM=Definiciones de lnea;FRC=Dfinitions ligne;ENC=Line Definitions';
      ltcDataExchMappingCard@1000000038 : TextConst 'ENU=Field Mapping;ESM=Mapeo de campos;FRC=Correspondance de champ;ENC=Field Mapping';
      ltcTransformationRuleCard@1000000039 : TextConst 'ENU=Transformation Rule Card;ESM=Ficha de regla de transformacin;FRC=Fiche Rgle de transformation;ENC=Transformation Rule Card';
      ltcPaymentBankAccountCard@1000000040 : TextConst 'ENU=Payment Bank Account Card;ESM=Tarjeta de cuenta bancaria de pago;FRC=Fiche compte bancaire paiement;ENC=Payment Bank Account Card';
      ltcCustTemplateCard@1000000041 : TextConst 'ENU=Customer Template;ESM=Plantilla cliente;FRC=Modle client;ENC=Customer Template';
      ltcItemTemplateCard@1000000042 : TextConst 'ENU=Item Template;ESM=Plantilla de producto;FRC=Modle article;ENC=Item Template';
      ltcVendorTemplateCard@1000000043 : TextConst 'ENU=Vendor Template;ESM=Plantilla proveedor;FRC=Modle fournisseur;ENC=Vendor Template';
      ltcCurrExchRateServiceCard@1000000044 : TextConst 'ENU=Currency Exch. Rate Service;ESM=Servicio de tipo de cambio de divisas;FRC=Service taux de change devise;ENC=Currency Exch. Rate Service';
      ltcDeferralTemplateCard@1000000045 : TextConst 'ENU=Deferral Template Card;ESM=Tarjeta de plantilla de fraccionamiento;FRC=Fiche modle chelonnement;ENC=Deferral Template Card';
      ltcSetupandHelpResourceCard@1000000046 : TextConst 'ENU=Setup and Help Resources;ESM=Configuracin y recursos de ayuda;FRC=Configuration et ressources d''aide;ENC=Setup and Help Resources';
      ltcO365ItemCard@1000000047 : TextConst 'ENU=Item;ESM=Elemento;FRC=Article;ENC=Item';
      ltcO365SalesCustomerCard@1000000048 : TextConst 'ENU=Customer;ESM=Cliente;FRC=Client;ENC=Customer';
      ltcO365SalesInvoice@1000000049 : TextConst 'ENU=Draft Invoice;ESM=Borrador de factura;FRC=Facture provisoire;ENC=Draft Invoice';
      ltcO365PostedSalesInvoice@1000000050 : TextConst 'ENU=Sent Invoice;ESM=Factura enviada;FRC=Facture envoye;ENC=Sent Invoice';
      ltcContactCard@1000000051 : TextConst 'ENU=Contact Card;ESM=Ficha contacto;FRC=Fiche contact;ENC=Contact Card';
      ltcContactAltAddressCard@1000000052 : TextConst 'ENU=Contact Alt. Address Card;ESM=Ficha direc. alt. contacto;FRC=Fiche adresse second. contact;ENC=Contact Alt. Address Card';
      ltcCampaignCard@1000000053 : TextConst 'ENU=Campaign Card;ESM=Ficha campaa;FRC=Fiche promotion;ENC=Campaign Card';
      ltcTodoCard@1000000054 : TextConst 'ENU=To-do Card;ESM=Ficha tarea;FRC=Fiche tche;ENC=To-do Card';
      ltcSalespersonPurchaserCard@1000000055 : TextConst 'ENU=Salesperson/Purchaser Card;ESM=Ficha vendedor/comprador;FRC=Fiche du reprsentant/de l''acheteur;ENC=Salesperson/Purchaser Card';
      ltcOpportunityCard@1000000056 : TextConst 'ENU=Opportunity Card;ESM=Ficha oportunidad;FRC=Fiche opportunit;ENC=Opportunity Card';
      ltcSavedSegmentCriteriaCard@1000000057 : TextConst 'ENU=Saved Segment Criteria Card;ESM=Fich. criterios seg. guardados;FRC=Fiche critre segment enreg.;ENC=Saved Segment Criteria Card';
      ltcCustomerTemplateCard@1000000058 : TextConst 'ENU=Customer Template Card;ESM=Ficha plant. cliente;FRC=Fiche modle client;ENC=Customer Template Card';
      ltcEmployeeCard@1000000059 : TextConst 'ENU=Employee Card;ESM=Ficha empleado;FRC=Fiche employ;ENC=Employee Card';
      ltcAlternativeAddressCard@1000000060 : TextConst 'ENU=Alternative Address Card;ESM=Ficha direc. alterna;FRC=Fiche adresse secondaire;ENC=Alternative Address Card';
      ltcCRMSalesOrder@1000000061 : TextConst 'ENU=Microsoft Dynamics CRM Sales Order;ESM=Pedido de venta de Microsoft Dynamics CRM;FRC=Document de vente Microsoft Dynamics CRM;ENC=Microsoft Dynamics CRM Sales Order';
      ltcFixedAssetCard@1000000062 : TextConst 'ENU=Fixed Asset Card;ESM=Ficha activo;FRC=Immobilisation - fiche;ENC=Fixed Asset Card';
      ltcDepreciationBookCard@1000000063 : TextConst 'ENU=Depreciation Book Card;ESM=Ficha libro amortizacin;FRC=Fiche registre amortissement;ENC=Depreciation Book Card';
      ltcFAPostingGroupCard@1000000064 : TextConst 'ENU=FA Posting Group Card;ESM=A/F Ficha grupo contable;FRC=Fiche paramtre report immo.;ENC=FA Posting Group Card';
      ltcInsuranceCard@1000000065 : TextConst 'ENU=Insurance Card;ESM=Ficha seguro;FRC=Fiche assurance;ENC=Insurance Card';
      ltcDepreciationTableCard@1000000066 : TextConst 'ENU=Depreciation Table Card;ESM=Ficha tabla amortizacin;FRC=Fiche table amortissement;ENC=Depreciation Table Card';
      ltcStockkeepingUnitCard@1000000067 : TextConst 'ENU=Stockkeeping Unit Card;ESM=Ficha unidad de almacenam.;FRC=Fiche d''unit de stock;ENC=Stockkeeping Unit Card';
      ltcLocationCard@1000000068 : TextConst 'ENU=Location Card;ESM=Ficha almacn;FRC=Fiche d''emplacement;ENC=Location Card';
      ltcResponsibilityCenterCard@1000000069 : TextConst 'ENU=Responsibility Center Card;ESM=Ficha centro responsabilidad;FRC=Fiche centre de gestion;ENC=Responsibility Centre Card';
      ltcNonstockItemCard@1000000070 : TextConst 'ENU=Nonstock Item Card;ESM=Ficha prod. no inventariable;FRC=Fiche article hors stock;ENC=Nonstock Item Card';
      ltcItemCategoryCard@1000000071 : TextConst 'ENU=Item Category Card;ESM=Ficha de categora de artculo;FRC=Fiche catgorie article;ENC=Item Category Card';
      ltcTransferOrder@1000000072 : TextConst 'ENU=Transfer Order;ESM=Ped. transfer.;FRC=Ordre de transfert;ENC=Transfer Order';
      ltcSourceDocumentFilterCard@1000000073 : TextConst 'ENU=Source Document Filter Card;ESM=Ficha filtro documento origen;FRC=Fiche filtre slection origine;ENC=Source Document Filter Card';
      ltcServiceOrder@1000000074 : TextConst 'ENU=Service Order;ESM=Pedido servicio;FRC=Commande service;ENC=Service Order';
      ltcLoanerCard@1000000075 : TextConst 'ENU=Loaner Card;ESM=Ficha prod. prestado;FRC=Fiche article de prt;ENC=Loaner Card';
      ltcServiceInvoice@1000000076 : TextConst 'ENU=Service Invoice;ESM=Factura servicio;FRC=Facture de service;ENC=Service Invoice';
      ltcStandardServiceCodeCard@1000000077 : TextConst 'ENU=Standard Service Code Card;ESM=Ficha cdigo servicio estndar;FRC=Fiche de code de service standard;ENC=Standard Service Code Card';
      ltcServiceQuote@1000000078 : TextConst 'ENU=Service Quote;ESM=Cotizacin servicio;FRC=Devis service;ENC=Service Quote';
      ltcPostedServiceInvoice@1000000079 : TextConst 'ENU=Posted Service Invoice;ESM=Factura servicio registrada (ventas);FRC=Facture de service reporte;ENC=Posted Service Invoice';
      ltcServiceItemCard@1000000080 : TextConst 'ENU=Service Item Card;ESM=Ficha producto servicio;FRC=Fiche d''article de service;ENC=Service Item Card';
      ltcServiceContractQuote@1000000081 : TextConst 'ENU=Service Contract Quote;ESM=Cotizacin Contrato de Servicio;FRC=Devis contrat de service;ENC=Service Contract Quote';
      ltcSerialNoInformationCard@1000000082 : TextConst 'ENU=Serial No. Information Card;ESM=Ficha informacin n serie;FRC=Fiche information n de srie;ENC=Serial No. Information Card';
      ltcLotNoInformationCard@1000000083 : TextConst 'ENU=Lot No. Information Card;ESM=Ficha informacin n lote;FRC=Fiche d''information sur le n de lot;ENC=Lot No. Information Card';
      ltcItemTrackingCodeCard@1000000084 : TextConst 'ENU=Item Tracking Code Card;ESM=Ficha cd. seguim. prod.;FRC=Fiche code traabilit;ENC=Item Tracking Code Card';
      ltcSalesReturnOrder@1000000085 : TextConst 'ENU=Sales Return Order;ESM=Devolucin venta;FRC=Retour vente;ENC=Sales Return Order';
      ltcPurchaseReturnOrder@1000000086 : TextConst 'ENU=Purchase Return Order;ESM=Devolucin compra;FRC=Retour achat;ENC=Purchase Return Order';
      ltcInvtAnalysisViewCard@1000000087 : TextConst 'ENU=Invt. Analysis View Card;ESM=Ficha de vista de anlisis de inventario;FRC=Fiche de vue d''analyse des stocks;ENC=Invt. Analysis View Card';
      ltcSalesAnalysisViewCard@1000000088 : TextConst 'ENU=Sales Analysis View Card;ESM=Ficha de vista de anlisis de ventas;FRC=Fiche de vue d''analyse des ventes;ENC=Sales Analysis View Card';
      ltcPurchaseAnalysisViewCard@1000000089 : TextConst 'ENU=Purch. Analysis View Card;ESM=Ficha de vista de anlisis de compras;FRC=Fiche de vue d''analyse des achats;ENC=Purch. Analysis View Card';
      ltcBaseCalendarCard@1000000090 : TextConst 'ENU=Base Calendar Card;ESM=Ficha calendario base;FRC=Fiche calendrier principal;ENC=Base Calendar Card';
      ltcConfigPackageCard@1000000091 : TextConst 'ENU=Config. Package Card;ESM=Configurar tarjeta de paquete;FRC=Fiche package config.;ENC=Config. Package Card';
      ltcProfileCard@1000000092 : TextConst 'ENU=Profile Card;ESM=Ficha de perfil;FRC=Fiche de profil;ENC=Profile Card';
      ltcUserPersonalizationCard@1000000093 : TextConst 'ENU=User Personalization Card;ESM=Tarjeta personalizacin usuario;FRC=Fiche de personnalisation utilisateur;ENC=User Personalization Card';
      ltcUserCard@1000000094 : TextConst 'ENU=User Card;ESM=Ficha de usuario;FRC=Fiche utilisateur;ENC=User Card';
      ltcDeviceCard@1000000095 : TextConst 'ENU=Device Card;ESM=Tarjeta de dispositivo;FRC=Fiche priphrique;ENC=Device Card';
      ltcSalesOrderInvoice@1000000096 : TextConst 'ENU=Sales Order Invoice;ESM=Factura pedido venta;FRC=Document de vente - Facturation;ENC=Sales Order Invoice';
      ltcInventoryCountCard@1000000097 : TextConst 'ENU=Inventory Count Card;ESM=Tarjeta de recuento de inventario;FRC=Carte de l''inventaire;ENC=Inventory Count Card';
      ltcWMDMPDAConfigCard@1000000098 : TextConst 'ENU=WMDM PDA Config Card;ESM=WMDM PDA Tarjeta de configuracin;FRC=WMDM PDA Config carte;ENC=WMDM PDA Config Card';
      ltcWMDMApplicationCard@1000000099 : TextConst 'ENU=WMDM Application Card;ESM=Tarjeta de aplicacin WMDM;FRC=WMDM Demande de carte;ENC=WMDM Application Card';
      ltcDynamicShipCustomsCard@1000000100 : TextConst 'ENU=DynamicShip Customs Card;ESM=Dyanmic Ship Aduanas;FRC=DynamicShip Carte douane;ENC=DynamicShip Customs Card';
      ltcDShipShipmentOptionCard@1000000101 : TextConst 'ENU=DShip Shipment Option Card;ESM=DShip Tarjeta de opcin de envo;FRC=Carte d''option d''expdition DShip;ENC=DShip Shipment Option Card';
      ltcWorkCenterCard@1000000102 : TextConst 'ENU=Work Center Card;ESM=Ficha centro trabajo;FRC=Fiche atelier;ENC=Work Centre Card';
      ltcMachineCenterCard@1000000103 : TextConst 'ENU=Machine Center Card;ESM=Ficha centro mquina;FRC=Fiche unit de production;ENC=Machine Centre Card';
      ltcPlannedProductionOrder@1000000104 : TextConst 'ENU=Planned Production Order;ESM=Orden produccin planificada;FRC=Ordre de production planifi;ENC=Planned Production Order';
      ltcFirmPlannedProdOrder@1000000105 : TextConst 'ENU=Firm Planned Prod. Order;ESM=Orden produc. planif. en firme;FRC=Ordre de production planifi ferme;ENC=Firm Planned Prod. Order';
      ltcReleasedProductionOrder@1000000106 : TextConst 'ENU=Released Production Order;ESM=Orden produccin lanzada;FRC=Ordre de production envoy;ENC=Released Production Order';
      ltcFinishedProductionOrder@1000000107 : TextConst 'ENU=Finished Production Order;ESM=Orden produccin terminada;FRC=Bon de production achev;ENC=Finished Production Order';
      ltcSimulatedProductionOrder@1000000108 : TextConst 'ENU=Simulated Production Order;ESM=Orden produccin simulada;FRC=Bon de production simul;ENC=Simulated Production Order';
      ltcRouting@1000000000 : TextConst 'ENU=Routing;ESM=Ruta;FRC=Itinraires;ENC=Routing';
      ltcProductionBOM@1000000110 : TextConst 'ENU=Production BOM;ESM=L.M. produccin;FRC=Nomenclature de production;ENC=Production BOM';
      ltcUnsupportedCardError@1000000109 : TextConst 'ENG=Drag n'' Drop not supported on %1';
      ltcDeposit@1000000111 : TextConst 'ENU=Deposit;ESM=Depsito;FRC=Dpt;ENC=Deposit';
      ltcPostedDeposit@1000000112 : TextConst 'ENU=Posted Deposit;ESM=Ingreso;FRC=Dpt report;ENC=Posted Deposit';

    PROCEDURE AddLinkToRecord@1000000000(ptxtPageName@1000000000 : Text;ptxtRecordText@1000000001 : Text;ptxtURL@1000000002 : Text;ptxtDescription@1000000003 : Text);
    VAR
      lrrRecRef@1000000004 : RecordRef;
      lriRecordID@1000000006 : RecordID;
      ltxtPrimaryKey@1000000008 : Text;
      liTableID@1000000010 : Integer;
      ltcUnsupportedCardError@1000000011 : TextConst 'ENU=Record Links are not supported on %1';
    BEGIN
      //<IW >
      //  Converts a Page Name to the corelated Table ID and builds the primary key.
      //  Then calls method to add the link to the record.
      //</IW>

      //assume default key is ptxtRecordText, handle special cards by case
      ltxtPrimaryKey := ptxtRecordText;

      CASE ptxtPageName OF
        ltcCurrencyCard: liTableID := DATABASE::Currency; //4
        ltcFinanceChargeTermsCard: liTableID := DATABASE::"Finance Charge Terms"; //5
        ltcSalespersonPurchaserCard: liTableID := DATABASE::"Salesperson/Purchaser"; //13
        ltcLocationCard: liTableID := DATABASE::Location; //14
        ltcGLAccountCard: liTableID := DATABASE::"G/L Account"; //15
        ltcCustomerCard: liTableID := DATABASE::Customer; //18
        ltcO365SalesCustomerCard: liTableID := DATABASE::Customer; //18
        ltcVendorCard: liTableID := DATABASE::Vendor; //23
        ltcItemCard: liTableID := DATABASE::Item;//27
        ltcO365ItemCard: liTableID := DATABASE::Item; //27
        ltcSalesQuote: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Quote
        END;
        ltcSalesOrder: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Order
        END;
        ltcSalesInvoice: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Invoice
        END;
        ltcBlanketSalesOrder: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '4,'+ptxtRecordText; //4 = Blanket Order
        END;
        ltcO365SalesInvoice: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Invoice
        END;
        ltcSalesReturnOrder: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '5,'+ptxtRecordText; //5 = Return Order
        END;
        ltcSalesOrderInvoice: BEGIN
          liTableID := DATABASE::"Sales Header"; //36
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Order
        END;
        ltcPurchaseQuote: BEGIN
          liTableID := DATABASE::"Purchase Header"; //38
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Quote
        END;
        ltcPurchaseOrder: BEGIN
          liTableID := DATABASE::"Purchase Header"; //38
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Order
        END;
        ltcPurchaseInvoice: BEGIN
          liTableID := DATABASE::"Purchase Header"; //38
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Invoice
        END;
        ltcBlanketPurchaseOrder: BEGIN
          liTableID := DATABASE::"Purchase Header"; //38
          ltxtPrimaryKey := '4,'+ptxtRecordText; //4 = Blanket Order
        END;
        ltcPurchaseReturnOrder: BEGIN
          liTableID := DATABASE::"Purchase Header"; //38
          ltxtPrimaryKey := '5,'+ptxtRecordText; //5 = Return Order
        END;
        ltcPostedSalesInvoice: liTableID := DATABASE::"Sales Invoice Header"; //112
        ltcO365PostedSalesInvoice: liTableID := DATABASE::"Sales Invoice Header"; //112
        ltcPostedPurchaseInvoice: liTableID := DATABASE::"Purch. Inv. Header"; //122
        ltcResourceCard: liTableID := DATABASE::Resource; //156
        ltcJobCard: BEGIN
          liTableID := DATABASE::Job; //167
          ltxtPrimaryKey := '"' + ptxtRecordText + '"';
        END;
        ltcBankAccountCard: liTableID := DATABASE::"Bank Account"; //270
        ltcPaymentBankAccountCard: liTableID := DATABASE::"Bank Account"; //270
        ltcICGLAccountCard: liTableID := DATABASE::"IC G/L Account"; //410
        ltcICPartnerCard: liTableID := DATABASE::"IC Partner"; //413
        ltcCashFlowForecastCard: liTableID := DATABASE::"Cash Flow Forecast"; //840
        ltcCashFlowAccountCard: liTableID := DATABASE::"Cash Flow Account"; //841
        ltcAssemblyOrder: BEGIN
          liTableID := DATABASE::"Assembly Header"; //900
          ltxtPrimaryKey := '1,'+ptxtRecordText;//1 = Order
        END;
        ltcAssemblyQuote: BEGIN
          liTableID := DATABASE::"Assembly Header"; //900
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Quote
        END;
        ltcBlanketAssemblyOrder: BEGIN
          liTableID := DATABASE::"Assembly Header"; //900
          ltxtPrimaryKey := '4,'+ptxtRecordText; //4 = Blanket Order
        END;
        ltcPostedAssemblyOrder: liTableID := DATABASE::"Posted Assembly Header"; //910
        ltcCostTypeCard: liTableID := DATABASE::"Cost Type"; //1103
        ltcCostCenterCard: liTableID := DATABASE::"Cost Center"; //1112
        ltcCostObjectCard: liTableID := DATABASE::"Cost Object"; //1113
      //  ltcDataExchDefCard: liTableID := DATABASE::"Data Exch. Def"; //1222
      //  ltcTransformationRuleCard: liTableID := DATABASE::"Transformation Rule"; //1237
      //  ltcCurrExchRateServiceCard: liTableID := DATABASE::"Curr. Exch. Rate Update Setup"; //1650
      //  ltcDeferralTemplateCard: liTableID := DATABASE::"Deferral Template"; //1700
        ltcContactCard: liTableID := DATABASE::Contact; //5050
        ltcCampaignCard: liTableID := DATABASE::Campaign; //5071
        ltcTodoCard: liTableID := DATABASE::"To-do"; //5080
        ltcOpportunityCard: liTableID := DATABASE::Opportunity; //5092
        ltcSavedSegmentCriteriaCard: liTableID := DATABASE::"Saved Segment Criteria"; //5098 //UNTESTED
        ltcCustomerTemplateCard: liTableID := DATABASE::"Customer Template"; //5105
        ltcEmployeeCard: liTableID := DATABASE::Employee; //5200
        ltcPlannedProductionOrder: BEGIN
          liTableID := DATABASE::"Production Order"; //5405
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Planned
        END;
        ltcFirmPlannedProdOrder: BEGIN
          liTableID := DATABASE::"Production Order"; //5405
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Firm Planned
        END;
        ltcReleasedProductionOrder: BEGIN
          liTableID := DATABASE::"Production Order"; //5405
          ltxtPrimaryKey := '3,'+ptxtRecordText; //3 = Released
        END;
        ltcFinishedProductionOrder: BEGIN
          liTableID := DATABASE::"Production Order"; //5405
          ltxtPrimaryKey := '4,'+ptxtRecordText; //4 = Finished
        END;
        ltcSimulatedProductionOrder: BEGIN
          liTableID := DATABASE::"Production Order"; //5405
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Simulated
        END;
        ltcFixedAssetCard: liTableID := DATABASE::"Fixed Asset"; //5600
        ltcFAPostingGroupCard: liTableID := DATABASE::"FA Posting Group"; //5606
        ltcDepreciationBookCard: liTableID := DATABASE::"Depreciation Book"; //5611
        ltcInsuranceCard: liTableID := DATABASE::Insurance; //5628
        ltcDepreciationTableCard: liTableID := DATABASE::"Depreciation Table Header"; //5642
        ltcResponsibilityCenterCard: liTableID := DATABASE::"Responsibility Center"; //5714
        ltcNonstockItemCard: liTableID := DATABASE::"Nonstock Item"; //5718
        ltcItemCategoryCard: liTableID := DATABASE::"Item Category"; //5722
        ltcTransferOrder: liTableID := DATABASE::"Transfer Header"; //5740
        ltcServiceOrder: BEGIN
          liTableID := DATABASE::"Service Header"; //5900
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Order
        END;
        ltcServiceInvoice: BEGIN
          liTableID := DATABASE::"Service Header"; //5900
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Invoice
        END;
        ltcServiceQuote: BEGIN
          liTableID := DATABASE::"Service Header"; //5900
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Quote
        END;
        ltcLoanerCard: liTableID := DATABASE::Loaner; //5913
        ltcServiceItemCard: liTableID := DATABASE::"Service Item"; //5940
        ltcPostedServiceInvoice: liTableID := DATABASE::"Service Invoice Header"; //5992
        ltcStandardServiceCodeCard: liTableID := DATABASE::"Standard Service Code"; //5996
        ltcItemTrackingCodeCard: liTableID := DATABASE::"Item Tracking Code"; //6502
        ltcSerialNoInformationCard: liTableID := DATABASE::"Serial No. Information"; //6504
        ltcLotNoInformationCard: liTableID := DATABASE::"Lot No. Information"; //6505
        ltcInvtAnalysisViewCard: BEGIN
          liTableID := DATABASE::"Item Analysis View"; //7152
          ltxtPrimaryKey := '2,'+ptxtRecordText; //2 = Inventory
        END;
        ltcSalesAnalysisViewCard: BEGIN
          liTableID := DATABASE::"Item Analysis View"; //7152
          ltxtPrimaryKey := '0,'+ptxtRecordText; //0 = Sales
        END;
        ltcPurchaseAnalysisViewCard: BEGIN
          liTableID := DATABASE::"Item Analysis View"; //7152
          ltxtPrimaryKey := '1,'+ptxtRecordText; //1 = Purchase
        END;
        ltcBaseCalendarCard: liTableID := DATABASE::"Base Calendar"; //7600
        ltcConfigPackageCard: liTableID := DATABASE::"Config. Package"; //8623
        ltcDeposit: liTableID := DATABASE::"Deposit Header"; //10140
        ltcPostedDeposit: liTableID := DATABASE::"Posted Deposit Header"; //10143
        ltcWorkCenterCard: liTableID := DATABASE::"Work Center"; //99000754
        ltcMachineCenterCard: liTableID := DATABASE::"Machine Center"; //99000758
        ltcRouting: liTableID := DATABASE::"Routing Header"; //99000763
        ltcProductionBOM: liTableID := DATABASE::"Production BOM Header"; //99000771
        ltcDeviceCard: liTableID := DATABASE::Device; //2000000130

        //ID instead of table name in case table doesn't exist (will not compile)
        ltcInventoryCountCard: liTableID := 23044304; //Inventory Count Header //UNTESTED
        ltcWMDMPDAConfigCard: liTableID := 23044504; //WMDM PDA Configuration
        ltcWMDMApplicationCard: liTableID := 23044527; //WMDM Application
        ltcDynamicShipCustomsCard: liTableID := 23044605; //DynamicShip Customs Header //UNTESTED
        ltcDShipShipmentOptionCard: liTableID := 23044608; //DynamicShip Shipment Option
        ELSE
          ERROR(ltcUnsupportedCardError, ptxtPageName);
      END;//case

      LinkToRecord(liTableID, ltxtPrimaryKey, ptxtURL, ptxtDescription);
    END;

    PROCEDURE LinkToRecord@1000000001(piTableID@1000000000 : Integer;ptxtPrimaryKey@1000000004 : Text;ptxtURL@1000000003 : Text;ptxtDescription@1000000002 : Text);
    VAR
      lrrRecRef@1000000008 : RecordRef;
      lriRecordID@1000000001 : RecordID;
    BEGIN
      //<IW  >
      //  Adds a link to a record associated with Table ID and primary key.
      //</IW>
      lrrRecRef.OPEN(piTableID, FALSE);
      ptxtPrimaryKey := lrrRecRef.NAME + ': '+ptxtPrimaryKey;
      EVALUATE(lriRecordID, ptxtPrimaryKey);
      lrrRecRef.GET(lriRecordID);
      lrrRecRef.ADDLINK(ptxtURL, ptxtDescription);
    END;

    BEGIN
    {
      ************************
      Copyright Notice
      This objects content is copyright of Insight Works 2016. All rights reserved.

      Any redistribution or reproduction of part or all of the contents in any form
       without this copyright notice is prohibited.
      ************************

       <REVISION author="W.Schock" date="11/16/17" version="IW17.11" issue="N/A">
         Add support for 'Deposit'.
         Add support for 'Posted Deposit'.
         Revise grammer in webservice creation message.
         Revise grammer in unsupported page message.
       </REVISION>
    }
    END.
  }
}

