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