Skip to main content

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": a

        {

            "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. 

 

 

Hi @thayden ,

Glad you found a solution! I had to do something similar recently-- I built a processing screen to update this data based on an Excel Import. If you want to go down the GI route, there is a table called CustSalesPeople that you should be able to use. Depending on what else you need to do, that table is changed via the SalesPersons view on the CustomerMaint graph. This took a lot of digging for me, so I am happy to share any of that code if it would be helpful. Admittedly, I know nothing about PHP, and I have not messed around with Acumatica API calls yet.

Do you only have one salesperson for each customer at your company? If so, updating via a process screen will be pretty straightforward.

Hopefully, you’ve already found an even better solution!

 

Best,

Aaron


Reply