Most hotel rooms nowadays have digital locks which are opened electronically with magnetic cards. The question often arises when a Jew is staying in a hotel over Shabbat whether he may ask a non-Jew to open the door to his room for him. It is obvious that a Jew may not open such a door himself on Shabbat, as it causes electricity and a light to go on. But may he ask a non-Jew, such as a maid or bell captain, to open the door for him?
The general consensus among the Halachic authorities is that opening a digital door by inserting a magnetic card on Shabbat would constitute at most a Rabbinic prohibition, due to the complex mechanics of the system. And when it comes to actions forbidden on the level of Rabbinic enactment, there is room to permit asking a non-Jew to perform such an action in certain situations, including Sa’ar (distress) or Sorech Gadol (a dire need). Since asking a gentile to perform forbidden activity on Shabbat is itself a Rabbinic prohibition, under certain circumstances it is permitted when the activity is itself a Rabbinic prohibition (Shebut De’shebut). And thus when a person has no other way of getting into his hotel room, he may ask a gentile to open the door for him.
Nevertheless, it is preferable to either arrange with a non-Jew before Shabbat that he will open the door when this is needed, or to ask him indirectly by hinting that he is needed to open the door. But if these two options are not possible, one may ask a non-Jew directly to open the door.
This is the ruling of Hacham David Yosef in his work Amira Le’akum (p. 206; listen to audio recording for precise citation).
Summary: If somebody is staying over Shabbat in a hotel room whose door opens only electronically, with a magnetic card, he should preferably arrange with a non-Jew before Shabbat that he will open the door for him when he needs, or hint to a non-Jew on Shabbat that he needs the door opened. However, if neither of these options is possible, one may ask a non-Jew directly to open the door.