0

I have two objects namely Class and Student. Student has a lookup field with Class object. When i create a new record in Student object I should have the ability to choose the lookup value of Class but once the record gets saved, when I click on the lookup field link which shows the Class record details, I should get an error/message saying that "I don't have necessary permissions to view the details of Class record" or any other error message. I would like to know whether it is possible in Salesforce.

1 Answer 1

1

Possible and realistic are two very different things. This is possible, but not using out of the box functionality.

The trouble is, the user needs access to the Class object in order to select a class record as the parent of the student. Lookups can't get around this.

Option 1

An option is to create a Visualforce page that performs this for you. The hard part is making the selecting of the Class record an user friendly task. You can then set the lookup field in the VF extension, and 'expose' the name of the Class as a formula field on the Student object.

There are a few variations to that process, which all depends on the actual use case, but that might give you a starting point.

Option 2

If the user is on a particular profile, you could either:

  • Update the page layout so that it has limited fields on it and assign it to that profile. This way if they go to the Class record, they won't see anything worth seeing
  • Create a VF page to override the View page of the Class object. In the controller, you check whether the user should see the page (maybe based on profile, maybe some other criteria). If they should, send them to the View page with the nooverride parameter. If not, display an error message.
2
  • Thanks for your suggestion. I understand your point but is there any way to restrict the user from seeing the class parent record details when they click on the class link using any security settings provided by Salesforce.
    – Ean
    Jul 19, 2016 at 13:13
  • In short, no. I've updated my answer with another option. Either way, it involves coding.
    – Nick Cook
    Jul 19, 2016 at 14:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.