It's a predicament we've all found ourselves in at some point in time - you walk into a room with the sole intention of getting a specific task done, but once you're in there, you have no memory of what your purpose was. It might have been something as banal as picking up a plate, or grabbing your phone, but it magically disappears. Well there's actually a term for the issue.
Forgetting why you've entered a room is actually called 'The Doorway Effect', a term coined by researchers at the University of Notre Dame in a 2011 study.
It's a phenomenon where some people passing through a doorway into another room end up forgetting things, and it's extremely common. What you need to know is that human memories are episodic, as opposed to being linear narratives, which means that they are split into segments.
Going through a doorway and entering another room creates a 'mental block' in the brain, which resets the memory to make room for the creation of a new episode
Your brain essentially refreshes itself because it believes the memories from the old room will be less relevant in the new room.
Also, if you're frustrated at the whole situation, keep in mind that the study also found that men and women in their 20s regularly forget why they entered the room at least once a week. Cheers!