Only user with Manage Account permission set can use this button, I have created this button but how can I add permission set with error message for other user. Could Anyone help me about this . Thanks in advance
{!requireScript("/soap/ajax/32.0/connection.js")}
var add = new sforce.SObject("Address");
add.Id = "{!Address.Id}";
add.Integration= true;
sforce.connection.update([add]);
window.location.reload();
var result = sforce.connection.query( SELECT PermissionSetId, PermissionSet.Name FROM PermissionSetAssignment WHERE
PermissionSet.Name = 'Manage PS Accounts']);
var psAssignment = result.getArray("records");
if(psAssignment.length === 0)
{
alert('You don't have access to this functionality.');
}