Developer forum

Forum » Integration » User sync - use customer number as key instead of external id

User sync - use customer number as key instead of external id

René Poulsen
René Poulsen
Reply

Hi,

I'm using the user sync (http://doc.dynamicweb.com/documentation-8/integration/other/integration-web-services) on a customer where we need to send users from NAV to DW.

In the description it says: "The user must have an ExternalID – this is used when retrieving the user from the Dynamicweb database.". In the NAV-integration I've set the Customer Number to be the key, beacuse we can have multiple users with the same ExternalID. Is it possible to use the Customer number as key in this user sync, instead of the ExternalID?


Replies

 
Nicolai Pedersen
Reply

Hi Rene

How can you have multiple users with the same externalid? The external id is meant to be ID = Identifier and it HAS to be unique, hence the wording. You must have some key that is unique - use that for this field...

BR Nicolai

 
René Poulsen
René Poulsen
Reply

Ok, maybe I don't understand this. We need to allow multiple users per company (I've checked the "Allow multiple users per company" in the Liveintegration framework).

Let's say we have two users (User A and User B) on the same Company. They have a Customer Number (e.g. K-001122 and K-334455) (it is unique for the user) and Number they have in common (99887766). I need to send the number they have in common to NAV, when requesting products, creating orders etc.

So when both User A and User B creates an order i want to send 99887766 to NAV in the UserID, because it's on the same company.

Can this be done without any changes to the Integration? Or would you recommend using the customer nubmers as the ExternalID and let the NAV-side handle the other part, finding the correct "company number" (99887766)?

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

Hi Rene,
you need to keep the ExternalID as a key from NAV to be imported to Dynamicweb to ensure the uniqueness and also as a part of this import you need to include the import of CustomerNumber to the Dynamicweb, so each user will have its own ExternalID and common CustomerNumber's.
If you are using the code from the http://doc.dynamicweb.com/documentation-8/integration/other/integration-web-services
then you can add saving user the CustomerNumber property:
user.ExternalId = "007";
user.CustomerNumber = "99887766";

Then you are right about "Allow multiple users per company" feature: it allows you to receive the information from the Dynamicweb current logged-in user Customer Number field value in the request to NAV.
For the product request you can see this value in the <GetEcomData ExternalUserID={customer number value}>
For the order request it will be in the tag: <CalculateOrder><Orders><Order><OrderCustomerAccessUserExternalId>{customer number value}</OrderCustomerAccessUserExternalId>
Regards, Dmitrij

Votes for this answer: 1
 
René Poulsen
René Poulsen
Reply

Hi Dimitriy,

If I understand you, when I set the "Allow multiple users per company" is the Customer Number then sent to NAV as the ExternalID? If it is, it's just what I'm looking for. Then I can have multiple users with the same CustomerNumber and a unique number in ExternalID. Then, when User A with ExternalID K-001122 and User A with ExternalID K-334455 requests products or creates an order it will still be the CustomerNumber (99887766) that is sent to NAV, because it's the CustomerNumber - and it's the same on both users.

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

Hi Rene,
yes, the Customer Number is sent to NAV as the ExternalID
Regards, Dmitrij

Votes for this answer: 1
 
René Poulsen
René Poulsen
Reply

The NAV side gets an error when sending one of the users through to us. Is it possible to see any log of what went wrong? They just get a boolean indicating success / error.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Rene,
yes, you need to enable the Liveintegration logging if it is not enabled:
- Log general errors
- Log connection errors
- Log response errors
- Log request and response content
Then you will be able to read the log file in the Files/System/Log/LiveIntegartion folder or in the Admin backend in Management Center->Integration->Integration Framework Live->
right click on LiveIntegrationAddIn and choose log.
Regards, Dmitrij

 
René Poulsen
René Poulsen
Reply

Hi Dimitriy,

Maybe I was not clear enough in my description of the problem. They get an errror when using the usersync (http://doc.dynamicweb.com/documentation-8/integration/other/integration-web-services). Does the liveintegration has anything to do with this?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Rene,
no for this kind of a problem there is no connection to the Live integration and there is no logging for that user sync saving.
There are a few moments that can cause exceptions when saving a user:
- "empty external id"
- "Username must have a nonempty value"
Maybe you can catch the response from the Dynamicweb service on your/NAV side and log the exception details there?
Regards, Dmitrij

 
René Poulsen
René Poulsen
Reply

I think there was something wrong on the NAV-side. We got it working now.

Thank you for your fast replies today - really great! :-)

 

You must be logged in to post in the forum