In a large skillet over low heat, melt the butter.
Add the chopped onions and cook until soft.
Add the apples and cook until tender.
Add the maple syrup or brown sugar. If using sugar, stir and cook until melted.
Add the beans, ketchup, cinnamon, molasses, mustard, and salt (if using).
Mix well and pour into a casserole oven-safe dish.
Bake at 400°F for an hour.
Randall Great Northern Beans were used. The recipe was inspired by the recipe on the back of the jar.