Solved

How to change default location of the customer through API

  • 8 October 2021
  • 6 replies
  • 595 views

Userlevel 2

Hello Everyone,

 

We are creating customer and customer locations in acumatica through REST API and these APIs are working fine.

 

But many of the customers has default location as a MAIN in acumatica and we want to change this default lcoation to other through customer or customer location API. 

 

I have extended the customer end point and added “SET AS Default” Action to the API but this is not giving the correct result. We are not able to change the default location of the customer through API.

 

 

What changes are required in customer or customer location API, to make the required location as default instead of MAIN. Can anyone suggest the solution or any work around for this.

Thanks in advance.

 

icon

Best answer by Naveen Boga 26 November 2021, 11:40

View original

6 replies

Userlevel 7
Badge +17

Hi @ssamboju12  To set the default location through REST API we need to perform the below steps.

Please find the details below.

***Request***

{

    "CustomerID": {

        "value": "AACUSTOMER"

    }

}

 

{

"entity": {

"CustomerID": {

"value": "AACUSTOMER"

},

"CustomerLocation": [

{

"id": "aae1ef14-b331-ec11-ba96-b40ede80c491",

"Default": {

"value": true

}

}

]

}

}

 

Userlevel 2

 Hello @Naveen B 

Thank you for the solution.

Similarly, we can achieve this by using below steps as well. 

1) Extend the default endpoint add the fields as below in the screenshot for the CustomerLocation and Customer entity

2. Get the LocationID2 of the Customer Location that you wanted to Default

3. Use the ID in the put request to update the default location for the customer

 

Userlevel 7
Badge +17

@ssamboju12  Awesome. Thanks a lot for sharing the another solution to achieve this requirement.

Hello guys, 
I would like to ask a question on this discussion because I was indeed asking myself the same question, and following your answers. 
I tried to apply your recommendations but I encounter a problem that I can't explain: 
when I use for example the following POST method 

{
    "entity": {
        "CustomerID": {
            "value": "AACUSTOMER"
        },
        "CustomerLocation": [
            {
                "id": "aae1ef14-b331-ec11-ba96-b40ede80c491",
                "Default": {
                    "value": true
                }
            }
        ]
    }
}
 

whatever ID I use to determine which address I want to apply the True value to, it’s automatically applied to the first row in the grid.
 have tried to apply other parameters in my condition to be more precise but the change is always applied to the first row of the existing addresses. 

Have you ever encountered this kind of case, and if so, is there a way to achieve the desired result? 

Thanks in advance for your help on this subject. 

Userlevel 7
Badge

Hi @mbrunerie43 you may want to post this as a new question referencing this post if you don’t get response. Thanks! 

Userlevel 2

Hello @mbrunerie43 

I have also faced the same issue like you. When I tried to update the location from API, it is always assigned to first row of the grid.

I have not verified the approach provided by @Naveen B  but the approch which i have mentioned in this ariticle is worked for me and resolved the issue.

Can you try with the approch which I have mentioned and let us know the response. 

We can help you further based on the response.

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved