Magento – magento change the completed order status into custom order status

magento-1.9order-statusorders

I have a order with the 'complete' status. I need to change it to a custom status.

I tried below code;

$orderId = '1000000055';
$order = Mage::getModel('sales/order')->load($orderId, 'increment_id');
$order->setState('custom_status_code', true);
$order->save();

But that not working. Can anyone please help me to solve this issue.

Best Answer

As a suggestion create a status of state complete then assign than custom status.

$orderId = '1000000055';
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$order->setStatus('custom_status_code');
$order->save();