0
votes

I'm new to salesforce frame work. But I have been very active in web development before. I have done a lot much practice on field level, object level and record level as well. But I can't figure out what how to cope with this scenario.

I have an object hotel (plural hotels) and I have look up field that refers to the manager "related to user". So the manager is the user that I created. "allan" and "steve" are the mangers of the hotels "hotel-abc" and "hotel-xyz" respectively. When either of them logs in they can see the records of both hotels.

But what I want is when allan logs in he should see the "hotel-abc" record and vice versa. I know field lever and object lever security are not applicable here but record lever is also not working for me. As it is so specific to some hard code condition!

Thanks in advance.

1

1 Answers

0
votes

I assume you have the sharing settings for Hotels set to private. This will essentially isolate visibility to the owner and those the owner chooses to share the record to. I am also assuming based on your description that "allan" and "steve" are the owners of the record which drives record level security.

However, if you are looking at this from the context of custom coding and apex code queries then you will want to make sure your classes are marked as "with sharing" which will ensure that the current user security context is applied to all queries. Otherwise, you could be seeing everything because the class is likely running in a system context.

i.e. Current User Context: public class with sharing SomeClass{}

System Context: public class without sharing SomeClass{}