My Products
Help
Steinar Møller
PARTNER

County number problem Customer

by Steinar Møller (Updated ‎17-05-2021 15:49 by Yıldırım VISMA )

I have a similar problem as Florian related to this, https://community.visma.com/t5/Forum-in-Developers-Visma-net/County-Number-problem/m-p/309847

 

When trying to post Customer with different country for main address and invoice address, this give no error in UI, only in API. The error can be "Error: County '1201' cannot be found in the system".

I have tried to post without county and with "county":null, both gives the error. Posting the same in UI also gives error, but in UI you may manually remove or change the value in the county field.

 

The code can be like this:

{"name":{"value":"Hans Hansen"},"number":null,"status":{"value":"Active"},"mainAddress":{"value":{"addressLine1":{"value":"Fanahammeren 3"},"addressLine2":{"value":null},"countryId":{"value":"NO"},"postalCode":{"value":"5244"},"city":{"value":"Fana"},"county":null}},"invoiceAddress":{"value":{"addressLine1":{"value":"Cannenburgh 9"},"addressLine2":{"value":null},"countryId":{"value":"NL"},"postalCode":{"value":"1187 DC"},"city":{"value":"Amstelveen"},"county":null}},"deliveryAddress":{"value":{"addressLine1":{"value":"Fanahammeren 3"},"addressLine2":{"value":null},"countryId":{"value":"NO"},"postalCode":{"value":"5244"},"city":{"value":"Fana"},"county":null}},"mainContact":{"value":{"name":{"value":"Hans Hansen"},"email":{"value":"hans@gmail.com"},"phone1":{"value":null},"attention":null}},"invoiceContact":{"value":{"name":{"value":"Hans Hansen"},"email":{"value":"hans@gmail.com"},"phone1":{"value":"+31 6 10001100"},"attention":null}},"deliveryContact":{"value":{"name":{"value":"Hans Hansen"},"email":null,"phone1":null,"attention":null}},"customerClassId":{"value":"6"},"corporateId":null,"vatRegistrationId":null,"attributeLines":null,"creditTermsId":null}
  
Attached the same posting manually in UI. 

Do you have any suggestion for solution?


5 REPLIES 5
Yıldırım
VISMA

by Yıldırım (Updated ‎06-05-2021 10:48 by Yıldırım VISMA )

Hello Steinar, 

have you tried the solution that is mentioned here, could you please check this out and inform us ? 
Thanks.

Steinar Møller
PARTNER

Yes, I have tried out this solution, unfortunately this do not solve the problem.

When we post this through the API this gives an error, but there are no problem posting this in UI.

 

It looks like the issue is connected to a check that should be passed when PUT/POST to the address sections that in the UI can be ticked to use "Same as main" and the country differs from the main address.

 

When separating the POST to send the address section with the different country code in a put, the "Error, the county "xxxx" cannot be found" is returned if "Same as main" is ticked.

If it is unticked, the error returned is:

"Error: An error occurred during processing of the field Postcode value "xxxx" Error: The postcode is invalid."
 
We'll report this to the development team and get back to you when we have more details. 
Yıldırım
VISMA

by Yıldırım (Updated ‎17-05-2021 15:51 by Yıldırım VISMA )

@Steinar Møller wrote:

The error can be "Error: County '1201' cannot be found in the system".

I have tried to post without county and with "county":null, both gives the error.
Posting the same in UI also gives error, but in UI you may manually remove or change the value in the county field.


Endpoint returns "County '1201' cannot be found in the system" when county field used like 

 

"county":null

 

 

If you'd like to skip assigning a value, you should remove the field from your payload. (Another null values as well)

Otherwise, please make sure the used CountyId exists in the Financials ERP. 


Example:

> Click to County selector to change the value , save and then select the requested county again save, to validate.
Window.png

PUT : Customer 

 

{

	"mainAddress": {
		"value": {
			"addressLine1": {
				"value": "Fanahammeren 3"
			},
			"countryId": {
				"value": "NO"
			},
			"postalCode": {
				"value": "5244"
			},
			"city": {
				"value": "Fana"
			},
			"county": {
				"value": "1221"
			}
		}
}
}

 

 

 

 

by Magnus Johnsen

Hi Steinar,

We'll have a look at it and get back to you.

Thank you!