Developer forum

Forum » Integration » Import addresses for users

Import addresses for users

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

SInce there seems to be no direct way to import addresses as part of an AccessUser import table, I decided to use the AccessUserAddresses table instead. That all seems to work fine, but how do I link an address to a user? The only ID I see in AccessUserAddress is AccessUserAddressUserID which is Dynamicweb's internal ID. Since that ID is auto-generated, I don't know it in my XML file.

Any ideas how I can import multiple addresses for an existing user?

Imar


Replies

 
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Imar,

In the User destination provider there is an option called "User key field" which is "AccessUserUserName" by default but you can change it to any other column that you are sure can be unique for the users(fx email). This column (if it exists in the mapping and in the "Source" for AccessUser table) will be used for searching of the existing users. The user addresses are imported after the users import. In the AccessUserAddress table mapping you need to specify the mapping for the destination column called: "AccessUserAddressUserID" and set the values from the source AccessUser "User key field" column values. Fx if you are using email as a user key field then you neeed to have in the fields ""AccessUserAddressUserID" values of users emails. At the addresses import the values for "AccessUserAddressUserID"s will be replaced by found users ids, if the user/users will not be found you will see warnings in the log file.

Regards, Dmitrij

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitrij,

Thanks, that worked great. For someone else implementing this: you also need to set the primary keys correctly. In my case I picked AccessUserAddressUserID and AccessUserAddressName so I can have unique addresses per type per user.

Thanks,

Imar

 
Espen Strømsnes
Reply

I'm having some trouble importing AccessUser addresses using the method above.

Is it possible to post some (simplified) sample XML of the case; i.e. when importing addresses on an AccessUser using email as "user key field" and which settings to use when creating the import job using the "User provider"?

My problem is that I'm unable to define the mapping for the destination column "AccessUserAddressUserID" to retrieve it's value from the AccessUser using the "user key field".

 
Dmitriy Benyuk
Reply

Hi Espen,
here is a sample xml file and destination user provider settings. In the field "AccessUserAddressUserID" you need to have the existing users emails
Regards, Dmitrij

Untitled.png
 
Espen Strømsnes
Reply

Thanks for the quick reply Dmitriy.

Unfortunately I cannot make this work. I have downloaded the sample file from you, replaced the email-address with one that exists on a user in my database and created a new import job (setting "User key field" to "AccessUserEmail").

When executing the job the following error occurs:

"Job Failed with the following message: Cannot perform '=' operation on System.Int32 and System.String."

What am I doing wrong?

 

Regards

Espen

 
Dmitriy Benyuk
Reply

Hi Espen,
this maybe becasue you are using an older Dynamicweb version. This was fixed in the TFS# 19070 in Dynamicweb 8.8
So you may need to upgarde
Regards, Dmitrij

 
Espen Strømsnes
Reply

Which revision do I need?

The version installed is 8.8.0.2.

 

Regards

Espen

 
Dmitriy Benyuk
Reply

Hi Espen,
could you try to open the existing job and save/save and close it? If it will not help could you make a new job with the same settings and try to run it?
Regards, Dmitrij

 
Espen Strømsnes
Reply

I have tried both suggestions, without luck:

  • open existing job, "save", "save and close" --> same error
  • create new job with the same settings --> same error

 

Regards

Espen

 

 
Espen Strømsnes
Reply

I upgraded to version 8.8.0.3 and created a new import job where I chose a custom field as the "User key field".

Now it works!

 

You must be logged in to post in the forum