I have a requirement where we want to route customers by prioritising the owner or Sales Team of a matched contact/lead for Chat. As far as I can tell, I can't achieve this using standard Queue-based or Skill-based routing - is there a way that I could use an Apex Trigger or a Flow to redirect chats to the most appropriate agent and override the standard routing behaviour?
you can use Omni-channel flows and set the preferred Agent to the owner/Sales Team member on the route work action.
Please check the below link
I've had a look into this and it appears the only way to override the built-in routing solution is to use an external routing solution, as you cannot update any of the fields on the AgentWork record once it has been created as per the Omni Channel Documentation for the AgentWork object.
The PendingServiceRouting object does not support Apex Triggers as per the Omni Channel Documentation for the PendingServiceRouting object, so you can't change which agent the PendingServiceRouting object is associated with on-platform.
As a result there isn't a way to customise routing for Omni Channel work items on-platform without building an external routing solution.