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? Jun 27, 2017 at 21:47

1 Answer 1

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, 2017 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, 2017 at 14:23

You must log in to answer this question.