Developer forum

Forum » Dynamicweb 10 » Retrieve UserAddresses by CustomerNumber

Retrieve UserAddresses by CustomerNumber

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I have a project where I need to list addresses by CustomerNumber instead of UserId.
I have tried the setting on the User module (responsible for listing addresses):

But it only lists the addresses assigned to the user.
I have also tried using the UserAddressService, but I get the same result. Only the addresses assigned to the user, regardless of the CustomerNumber.
Is this a bug?

Any alternative ways to retrieve the Addresses based on CustomerNumber?

Thank you,
Adrian


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Could be - but the code looks correct. Could also be bad data...

Can you show us the data for user number 2 and that users address records? 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,
Sure. I am using the same data I use in DW9. I get the data sync from the same NAV instance.
We sync all delivery addresses to the same User, but we have different values for CustomerNumber on them.
For ease of comparison, I have displayed the results using 2 different methods:

You can see the different count. The user has 2 addresses connected directly to it and another 8 connected to the generic user.:

If you want to dig deeper, you can find it here: https://elbi.ignite.commergent.ro/

Thank you,
Adrian

 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

How does the 2 user records look like?

User with id 5795 and 1281 - so they both share customer number?

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

No. The generic user does not have a CustomerNumber but the addresses have.
 

Adrian

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

The label says "Own addresses and addresses of users with same customer number"

So your user 5795 needs to have the same customer number as the user 1281.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hmm. I see.
I will check if we can create separate users for each Customer number on the address.
Thank you for clarifying this issue.

Adrian

 

You must be logged in to post in the forum