Hello Paul,
I tried to repeat the manually what your routine I guess it does and I wasn't able to experience the behaviour you described.
I can only guess the reason is the custom HAL
Sorry for not being more helpful.
The register for Order Classes is common for Sales orders and Service orders. When I set an Order Class to create an Activity - it works for Sales Order, while for Service Orders - not. Is any setting...