My Products
Help
Anonymous
Not applicable

Customer location

by Anonymous

How do I set location on customer object. I can create Location object and set countryID and Id but i cant find how to set my Customer to this then ?

5 REPLIES 5
Anonymous
Not applicable

by Anonymous

Ok. Big thanks.


I get all locations now for a customer but i cant find the one with "is default". How can I get that one ?

Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

The "default" mark is not exposed via the API, but if you want to use the default location, you don't need to specify it in the customerInvoice JSON.

You only need to specify the location if:

1. You want to use a different location than the default

2. If no locations are marked as default

In both of these situations, you probably have some directions from the customer of your integration as to what should be chosen, either that it is specified by them when using the integration or that they have a set of rules for it, either way, it would operate as they would normally operate in the UI. 

Anonymous
Not applicable

by Anonymous

Ok so every customer has it own location, but  what happens if I create a customer without creating a location.

 

I created this customer and i got locationID "Main" ... and then I created a second customer and it got locationID Primary - without any location creation. 

 

When I try to create a customerinvoice for this customer then i get an erron and it says that "location was not found".

by Magnus Johnsen (Updated ‎05-10-2021 16:07 by Magnus Johnsen VISMA )

Hi,

Did you create both customers now? It sounds like it might have to do with localisation.

For example, all customer created in my company get the default location "Main"(language set to UK), whereas when setting my language to Swedish the default location name is set to "Primär":

2021-10-05 16_04_37-Kunder - Brave.png

If you have customers on which you often use different locations we would recommend that you first get the locations:

Get /controller/api/v1/location/<Supplier or Customer number>

 

If you don't specify a location in the customerInvoice, the location marked as "default" will automatically be added to the invoice.

by Magnus Johnsen (Updated ‎05-10-2021 15:39 by Magnus Johnsen VISMA )

Hi,

You specify what customer/supplier it should be assigned to on the location itself with the "baAccountId":

POST /controller/api/v1/location

 

JSON: 

{
  "baccountId": {
    "value": "10000"
  },
  "locationId": {
    "value": "LocationViaAPI"
  },
  "locationName": {
    "value": "LocationViaAPI"
  },
  "active": {
    "value": true
  }
}
 
Result on the customer card:
2021-10-05 15_37_19-Customers - Brave.png