AX2012R2 – What company am I in?

Found a strange occurrence in the system today when moving between the main system and the development environment. The status bar shows the company that is active. However when doing some testing I noticed that if the companies in the two environments are different, when I change from the development environment to the client, the system will report the change of company.

However if I change from the client the development environment, assuming it is already open, it will not do the same, keeping the active company as the one from the client, even through the status bar in the development environment states otherwise.

So be careful if you are running classes or jobs that update data in a multi company environment. You should always code the required company into the class or job to ensure it cannot be accidentally run from the wrong company.