Skip to main content
Solved

How to change default location of the customer through API


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.

 

Best answer by Naveen Boga

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

                }

            }

        ]

    }

}

 

View original
Did this topic help you find an answer to your question?

6 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • Answer
  • November 26, 2021

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

                }

            }

        ]

    }

}

 


  • Author
  • Freshman II
  • 14 replies
  • December 3, 2021

 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

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • December 3, 2021

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


  • Freshman II
  • 6 replies
  • January 5, 2022

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. 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2642 replies
  • January 7, 2022

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


  • Author
  • Freshman II
  • 14 replies
  • January 10, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings