Bulk Update Salesperson on Customer Records

  • 16 May 2024
  • 0 replies
  • 42 views

Sanity check post.

Going through all my options within Acumatica I have found it lacks the support around bulk updating customers and the salespersons linked to it. My first attempt was building a GI or using the Customers GI and enabling mass update. This did not work as Salesperson was not an available field.

Next step was I saw a couple post on using an import scenario that could update the salesperson and use of the " <Line Number> = -2 " to delete the existing salesperson. That would of gotten me close but still felt that was not very easy to accomplish for most with the system.

The solution I landed on was developing code to call the Customers Endpoint and expand to include Salespersons.

https://YOURURL.acumatica.com/entity/Default/22.200.001/Customer?$expand=Salespersons&$filter=CustomerClass eq 'YOURCUSTOMERCLASS'

I added a filter to give me all customers within a certain class as we have our salespersons aligned to customer classes. 

From there I looped through each customer and looked at the “MAIN” LocationID to see if the salesperson was set to the new salesperson. If it was not, I had to count the number of existing salepersons and execute the call below to delete each one.

PUT:https://YOURURL.acumatica.com/entity/DEFAULT/22.200.001/Customer?$expand=Salespersons

BODY: 

{

    "CustomerID": {

        "value": "CUSTOMERNUMBER"

    },

    "Salespersons": [

        {

            "LocationID": {

                "value": "MAIN"

            },

            "delete":true

        }

    ]

}

Once that was all done, I was finally able to use a put call to add the correct salesperson to the company record. 

 

PUT: https://YOURURL.acumatica.com/entity/DEFAULT/22.200.001/Customer?$expand=Salespersons

BODY: 

{

    "CustomerID": {

        "value": "CUSTOMERNUMBER"

    },

    "Salespersons": [

        {

            "LocationID": {

                "value": "MAIN"

            },

             "SalespersonID": {

                "value": "SALESPERSONID"

            },

                "Default": {

                    "value": true

                }

        }

    ]

}

 

I decided to go down the path of development as now I’ve got an easy process going forward that just requires me to update the following variables in my PHP code and I’m able to run the script and update all within minutes. 

 

$customerClass = ‘CUSTOMERCLASS’

$salespersonID = ‘NewSALESPERSONID’

 

I’ll end with, is there already an enhancement request out there with Acumatica to have something developed within the system that my operations or sales team can use to manage updating Salespersons? I’d perfer this responsiblity didn’t fall on IT and my team. 

 

 


0 replies

Be the first to reply!

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