function onSample() { var command = scene.getCommandById("myCmdId"); if (command) { // Disable this command. command.disabled = true; } }