I've created my own custom status and assigned it to a state.
This works fine if I load an order, set the status and save as in the following:
$order = Mage::getModel('sales/order')->load($orderId);
$order->setStatus('custom_status_code');
$order->save();
However, when I want to set the custom status after invoicing by observing the "sales_order_invoice_register" event, sometimes it saves the custom status while other times it doesn't.
I'm guessing that sometimes the way Magento sets its own status gets triggered after mine. How would I get my custom status to be set last and not be overridden?
Thanks.