[SalesForce] How to access permissionSet object permission

I have tried few different way and I'm not getting what I want so basically I'm after finding out what object permission a permissionSet has for the object.

As you can see the attach screen shot and I'm trying to retrieve PermissionsRead, PermissionsEdit, PermissionsCreate, PermissionsDelete whether its true/false

enter image description here

I run this query but even though I turn off PermissionsDelete I still see it to be true and I think I'm not querying the right way.

First run this query:

SELECT Id from Profile where Name = 'Custom: Support profile'

Query based off the profile:

SELECT Id from PermissionSet where ProfileId = '00e6A000000zNUhQAM'

SELECT Id, PermissionsRead, PermissionsEdit, PermissionsCreate, PermissionsDelete from ObjectPermissions where ParentId = '0PS6A000000sADfWAM' and SObjectType = 'Account'

I'm after finding out what permissionSet(account delete) object permission has.

Best Answer

Run query to find out what Permission Set Id is:

SELECT Id from PermissionSet where Label = 'account delete'

Then plug in returned Permission Set Id into this query:

SELECT Id, PermissionsRead, PermissionsEdit, PermissionsCreate, PermissionsDelete from ObjectPermissions where ParentId = 'yourPermissionSetId' and SObjectType = 'Account'

If you want for the users assigned to the Profile 'Custom: Support profile' and 'account delete' Permission Set to do not able to delete Account records, it has to be unchecked for BOTH