Migrate sforce.connection.query to Lightning equivalent

As you probably know, Javascript buttons are not supported in Lightning Experience (LEX). In particular, you can't use REQUIRESCRIPT.