how to make hardware profile persistent

We are trying to make the "Docked profile" to have external manitor as a primary and laptop's
monitor as a secondery with different resolution for each monitor. And when undocked automatically
switch back to laptop monitor. And make it persistent. Currently after undocking and redocking
the laptop stays primary. We are using a ThinkPad x201 with an x200 UltraBase.

Who is Participating?

lenovo/ibm is notorious for crummy vid handling and the culprit is usually the presentation director. With that and the drivers correct and updated your display profiles should remain persistent without any extra effort.

docked, in Settings your display should be monitor #1, with the laptop display greyed out as #2. undocked there should only be laptop monitor as #1. Ensure that when docked your have not set the #2 monitor to be 'extended'