You need to sign in to do that
Don't have an account?
marcob
PermissionsModifyAllData
Hi,
Is there a way to use the PermissionsModifyAllData field from the Profile object in Apex? I can see in the schema that it is included in the Profile object. However, when i try to use that field, it says that the field name is incorrect, check spelling. It appears to me that all the Permission-fields in the profile don't have the name the schema tells me.
Any suggestions?
Thanks in advance!
Br, Marco
That field is not available like this. I say this as you can't include it in a normal formula field.
I think you will need to get the value via a query in your controller. That should work, but I have not tried it myself.
All Answers
Just ran this SOQL query and it returned values.
select PermissionsModifyAllData from Profile
Maybe posting your code would help.
Hi Mike,
thanks for your respons, it actually works in Apex. Actually, my initial problem was that it doesn't work in VisualForce pages, but i wasn't clear on that, sorry!
So, i now solved it in the controller, but still wondering why this doesn't work in VF:
<apex:commandButton value="Delete" action="{!DeleteAll}" rendered="{!$Profile.PermissionsModifyAllData==true}"/>
Profile fields like Name and Description can be referenced in VF, but the permission fields like PermissionsViewDataCategories, PermissionsViewAllData, etc can't be referenced.
Maybe the actual name is different then it shows in the schema?
Br, Marco
And since we're at it, is there a way to check whether the profile has ModifyAllData rights for a specific object? I can't seem to find an object that holds the relation between Profile and (custom) Object.
Br, Marco.
That field is not available like this. I say this as you can't include it in a normal formula field.
I think you will need to get the value via a query in your controller. That should work, but I have not tried it myself.
Ok, i think this confirms my own thoughts, i will stick to apex and not try to solve anything in the VF page.
Many thanks for your help Mike!
Br, Marco