If you are talking about a Webasto diesel furnace, it runs off the batteries, so will work underway, at anchor, or while on shore power with the battery charger replenishing the batteries.
Our 2012 R29 also has a heater at the helm that uses engine heat like a car's heater. That one only works when the engine is running.