Developer forum

Forum » Integration » No customers from NAV

No customers from NAV

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

I'm trying to fetch customers/contacts from NAV 2018 using the standard integration.
Products are working just fine, but when I try to fetch customers/contacts I get nothing.

There are both customers and contacts in NAV, and it looks fine
This is what I send, and what I receive.

Request

<GetEcomData><tables><Customers type="all" /></tables></GetEcomData>

Response

<?xml version="1.0" encoding="utf-16"?>
<tables version="1.2.0.5_NAV11.0.20348">
  <table tableName="AccessUserGroup">
    <item table="AccessUserGroup">
      <column columnName="AccessGroupGroupName"><![CDATA[Customers]]></column>
      <column columnName="AccessGroupName"><![CDATA[Customers]]></column>
    </item>
  </table>
  <table tableName="AccessUser" />
  <table tableName="AccessUserAddress" />
</tables>

Are there any setup that need to be done inside NAV?


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Martin,
yes, your contacts should be connected to the companies, companies to the customers, then the customers will be retrieved.
See the standard Cronus Company setup for the Customer 20000:

Customer -> Navigate -> Contacts:

Customer card:

Kind regards, Dmitrij

Votes for this answer: 1
 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Hi Dmitrij!

Thanks for your quick reply.
Unfortunatly I have verified this, and made sure that it is setup just the way you explain. Still, we do not get anycontacts/customers.

Sure there are no other settings that need to be set before it can work?
By the way, we are on NAV 2018.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Martin,
no, here is a code which is responsible for that:
 

Contact.SETRANGE(Type, Contact.Type::Person);
        CompanyContact.SETRANGE(Type, Contact.Type::Company);
        if Contact.FINDSET(false, falsethen begin
            repeat
                //Find Customer/Company
                ContactBusiness.SETRANGE("Contact No.", Contact."Company No.");
                if ContactBusiness.FINDFIRST then begin
                    if Customer.GET(ContactBusiness."No.") and (Contact."Company Name" = Customer.Name)
                      and CompanyContact.GET(Contact."Company No."then begin
                        XmlHelper.AddElement(XmlAccessUserChild, 'item''''', itemNode);
                        XmlHelper.AddAttribute(itemNode, 'table''AccessUser');
                        XmlHelper.AddField(itemNode, 'AccessUserUserName', Contact."E-Mail");
                        XmlHelper.AddField(itemNode, 'AccessUserExternalID', Contact."No.");
                        XmlHelper.AddField(itemNode, 'AccessUserCustomerNumber', ContactBusiness."No.");
                        XmlHelper.AddField(itemNode, 'AccessUserName', Contact.Name);
                        //Use company address
                        XmlHelper.AddField(itemNode, 'AccessUserEmail', CompanyContact."E-Mail");
                        XmlHelper.AddField(itemNode, 'AccessUserPhone', Customer."Phone No.");
                        XmlHelper.AddField(itemNode, 'AccessUserFax', Customer."Fax No.");
                        XmlHelper.AddField(itemNode, 'AccessUserAddress', Customer.Address);
                        XmlHelper.AddField(itemNode, 'AccessUserAddress2', Customer."Address 2");
                        XmlHelper.AddField(itemNode, 'AccessUserZip', Customer."Post Code");
                        XmlHelper.AddField(itemNode, 'AccessUserCity', Customer.City);
                        XmlHelper.AddField(itemNode, 'AccessUserCountry', Customer."Country/Region Code");
                        XmlHelper.AddField(itemNode, 'AccessUserAddressTitle''Company address');
                        XmlHelper.AddField(itemNode, 'AccessUserCompany', Contact."Company Name");
                        //
                        if Customer."Currency Code" <> '' then
                            XmlHelper.AddField(itemNode, 'AccessUserCurrencyCharacter', Customer."Currency Code")
                        else
                            XmlHelper.AddField(itemNode, 'AccessUserCurrencyCharacter', glsetup."LCY Code");
 
                        XmlHelper.AddField(itemNode, 'AccessUserActive''true');
                        XmlHelper.AddField(itemNode, 'AccessUserWeb', Contact."Home Page");
                        XmlHelper.AddField(itemNode, 'AccessUserGroups''Customers');
                        UsersPublisher.OnAddContactXmlNode(itemNode, Contact, Customer);
                    end else begin
                        //Do not import Contact that doesn't belong to any Customer
                    end;
                end;
            until Contact.NEXT = 0;
        end;


Kind regards, Dmitrij

 

You must be logged in to post in the forum