Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Navison 2017(CU7) tableType = ExternalSQL, REGISTERTABLECONNECTION error

Posted on by

Hi All,

I have one question for inserting externalSQL table.

I have to add one view from another sql database into Nav 2017(CU7) for CRM Connector, becouse I have some issues with NULL values in custom CRM view in SQL database.

I created simple table with this setup:

table_5F00_setup.jpg

On sql databse is it in database xxxx, and view has name dimSYSTEMY_CRM_w

Than I prepared page list on this table and insered code into onInit and openPage trigger to call codeunit function for table registration.

Code looks same like core in function IsCRMIntegrationEnabled in CU 5330:

function:

IF NOT HASTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,GETDEFAULTTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL)) THEN BEGIN

IF lreCRMConnectionSetup.GET THEN;
IF NOT ISNULLGUID(lreCRMConnectionSetup."User Password Key") THEN
IF lreServicePassword.GET(lreCRMConnectionSetup."User Password Key") THEN BEGIN
UNREGISTERTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL, 'xxxx');
REGISTERTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,'xxxx',STRSUBSTNO(ConnectionStringFormat,'yyyy','xxxx',lreCRMConnectionSetup."User Name",lreServicePassword.GetPassword));
SETDEFAULTTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,'dimsystemy_crm_w');
END;
END

IF I call this function separately, navision register table without any errros (I can debug it). But if run Page List of this table (my function is on onInit and onOpen page trigger), navision will show error, that I have to use commnad RegisterTableConnection or New-NavTableConnection in cmdlet, before i open this page.

I cant use debugger, becouse navision dont stop on break point a application will drop down with debugger.

I wanted to try use New-NavTableConnection, but I not have it in cmdlist.

chyba2.jpg

chyba3.jpg

Thank you for answers...,

George

*This post is locked for comments

  • Verified answer
    George Husek Profile Picture
    George Husek on at
    RE: Navison 2017(CU7) tableType = ExternalSQL, REGISTERTABLECONNECTION error

    I found solution.

    I had to create view into Navision database, add rights to user on nav service to some databases and I change code to this:

    //A019 -->
    IF HASTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,'yyyyy') THEN
    UNREGISTERTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL, 'yyyyyy');
    IF lreCRMConnectionSetup.GET THEN;
    IF NOT ISNULLGUID(lreCRMConnectionSetup."User Password Key") THEN
    IF lreServicePassword.GET(lreCRMConnectionSetup."User Password Key") THEN BEGIN
    DATABASE.REGISTERTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,'yyyyyy','Data Source=xxxxx;Initial Catalog=NAV2017_TEST;Integrated Security=SSPI');

    SETDEFAULTTABLECONNECTION(TABLECONNECTIONTYPE::ExternalSQL,'yyyyy');
    END;
    //A019 <--

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans