0

I have custom related lists built with Visualforce and APEX Controller with Edit and Delete command links.

I was wondering if there is a possibility to show these command links based on profiles. My search has been unsuccessful til now.

If there are any? which are they? I don't have too much experience in programming with Visualforce and APEX and maybe there is something I don't know yet and somebody can tell me what I am missing.

I would really appreciate.

1
  • Hi, welcome to SFSE. I really recommend you take a look at the How to Ask page. In this case, can you share us snippets of code and explain your problem in more detail? – Sebastian Kessel Jun 27 '17 at 21:47
1

You'd want to use {!$ObjectType.SObjectName.updateable} and {!$ObjectType.SObjectName.undeletable}, or the Apex Code equivalents (replace SObjectName with the appropriate object type, such as Account or Custom_Object__c).

Example:

<apex:commandLink rendered="{!$ObjectType.Account.Deleteable}" action="{!deleteRecord}" ...
2
  • Thanks for responding. Sorry about my ignorance (my lack of much experience in programming), but where is the part where {!$ObjectType.SObjectName.updateable} and {!$ObjectType.SObjectName.undeletable} can be used for profiles. Say I have two profiles: one can delete, the another can't. Can you give me an example?. – user10267 Jun 28 '17 at 7:09
  • @user10267 The system automatically calculates if the user can or can't based on their current permissions (profile and any permission sets). Simply by setting their profile permissions correctly, the link will appear only for users with the appropriate permissions. – sfdcfox Jun 28 '17 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy