How to inject data to Customer Address Line 2 using Microsoft Business Central API
Views (6)
Creating a customer record in Microsoft Dynamics 365 Business Central is a topic I blogged about in one of my previous blog posts. If you have not read them yet I suggest you read it before going through this for better understanding.
Part 01: Getting Started with Dynamics 365 Business Central APIs
Part 02: Understanding Microsoft Business Central Out-Of-The-Box API Endpoints
Part 03: Understanding Microsoft Business Central Custom API Endpoints
If you want to insert below address to Business Central Customer Card then how would your JSON body look like?
First Attempt:
Outcome :
As you can see the first attempt did not work as expected. Address and Address 2 both end up in one field.
Second Attempt :
Outcome:
It did work and the "Address 2" field gets filled with the data we wanted. The change I did was I added \r\n into my JSON body. \r\n is used as a newline character in Windows and this is a very common way to go to a new line.
Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara
Part 01: Getting Started with Dynamics 365 Business Central APIs
Part 02: Understanding Microsoft Business Central Out-Of-The-Box API Endpoints
Part 03: Understanding Microsoft Business Central Custom API Endpoints
If you want to insert below address to Business Central Customer Card then how would your JSON body look like?
Field Name in BC | Data to inject |
Address | 2/34 |
Address 2 | Coliseum Drive |
City | Albany |
County | Auckland |
Country | NZ |
Postal Code | 0632 |
First Attempt:
1 | { |
Outcome :
As you can see the first attempt did not work as expected. Address and Address 2 both end up in one field.
Second Attempt :
1 | { |
Outcome:
It did work and the "Address 2" field gets filled with the data we wanted. The change I did was I added \r\n into my JSON body. \r\n is used as a newline character in Windows and this is a very common way to go to a new line.
\r\n = CR + LF → Used as a new line character in Windows
Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara
This was originally posted here.
*This post is locked for comments