Developer forum

Forum » Dynamicweb 10 » Lookup UserId on Address Import

Lookup UserId on Address Import

Kayla Lumpford-Mitchell
Reply

We are trying to import Addresses from our D365 ERP into DW10. We are using the CustomerNumber as our primary key in D365, but since the customers are imported/created in DW, there is currently no mapping from User Accounts in DW to D365. What we would like to do is set the UserId on the AccessUserAddress table to the UserId of the AccessUser with the matching CustomerNumber off of the AccessUserAddress. In our case AccessUserCustomerNumber is the key to mapping our addresses to DW users, but we don't have the AccessUserID in our Address file, as it comes from D365. Could we use the @Code scripting to look up the UserId off of the AccessUser table during the import process? 
Or another way to have the UserId on the newly imported address match the AccessUser record based on AccessUserCustomerNumber? If we just map AccessUserCustomerNumber to AccessUserAddressUserId, because it is a required field, we end up with the addresses going to the wrong records since some CustomerNumbers match UserIds in the AccessUser table. 

Any help here would be appreciated.

Version: 10.20.11


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Kayla,

Take a look at this blog post: https://doc.dynamicweb.com/community/devblog/blog/alternatives-to-applying-code-in-you-integration-flow?PID=8967

It describes the following flow in more detail:

1. Create a new temporary table for the addresses
2. Import into this temp table
3. Create a view that JOIN address data and user data (AccessUser and AccessUserAddress) on the customer number. This gives you the addresses and the customer ID
4. Import into addresses by querying data from the view.

Hope this helps,

Imar

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Kayla,
You can use the UserProvider as your destination provider to import the User Addresses. You need to select the AccessUserCustomerNumber in the User key field:


And have a mapping from AccessUserCustomerNumber -> AccessUserAddressUserId. Then at the import the existing users will be searched by the CustomerNumber field and first found user id will be used for the AccessUserAddressUserId field.
Best regards, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Kayla,
I confirm Imar's suggestion, I actually followed it :)

The first thing you need to consider is whether you will have multiple users for the same CustomerNumber.
If you do, you should choose if you duplicate the addresses for each user of a customer or create a dummy user for each Customer number and store the addresses on it.
You can then take advantage of the new listing of addresses based on CustomerNumber. You have this option in the Customer Experience Center module, in the cart and also in the UserService (if you code in the template for Address listing).

The alternative of using UserProvider, relies on having the value used for UserName in the AccessUserId field on the addresses. If you have 1:1 relations, you may be able to use the email address to connect the 2 lists. You can find some info here: https://doc.dynamicweb.com/documentation-9/integration/integration-framework/data-integration-activities/user-provider.

Adrian

 

You must be logged in to post in the forum