Q. How come some buildings have Sabbath Elevators but then the Jewish People who don’t want to wait for the elevator, ask others to push button for them? Isn’t this against the laws of Sabbath? If this could be done, why have a Sabbath Elevator? I simply tell them no, it is against the Torah.

A. Indeed, it is prohibited to ask even a Gentile to do a prohibited task on Shabbat. However, if the Gentile is going anyway to the same floor, you may ride with him, since he is pressing the button for his own use, not for you, (there may be other issues involved, such as different sensors that you may activate unwittingly; in practice a competent rabbinical authority should be consulted with the particular details on each case.)
If a non observant Jewish individual is the one pressing the button, you may not use the elevator with him, as you would be benefiting from prohibited work done on Shabbat.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a