Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am building a performance management tool for my organization, where the top Performance__c table needs to be private, so as to obscure the quota and commission data per employee.

Challenge: Allow the records to be visible for all users, but only Id and OwnerId...

... when they create an opportunity, I have a trigger that adds them as a default "revenue split" and their partner as an "overlay split" to a new OpportunitySplit__c table which is a master-detail of the Performance__c table. They are obviously not able to add the overlay split, since they cannot see their partner's Performance__c record to insert it as the master lookup Id...

Do I need to use an @future call to accomplish this without opening up all visibility to everyone?

share|improve this question
up vote 5 down vote accepted

You just need an apex class that handles the logic from your trigger that is WITHOUT SHARING, which will allow you to update any fields on any Performance__c record, regardless of ownership or sharing rules.

One word of warning about classes WITHOUT SHARING... you are giving up the built in permission restrictions and basically managing them yourself within your apex logic at that point. This is powerful and introduces risk into your custom automation. You'll want to make sure to unit test not only the scenarios that you want but also the scenarios that you don't want, and confirm that they're not possible.

share|improve this answer
Interesting. The only thing I'm really worried about is viewership, so this might work. I'll give it a shot and report back shortly! – Nathan Williams May 6 '14 at 23:24
Ok found it. I am utilizing Hari Krishnan's trigger framework and found that I wasn't going high enough up in the chain to affect the "without sharing" fact. Once I modified the TriggerFactory class, everything worked fine. I'll have to keep this in mind as I build future triggers, but more often than not, I'd like to keep data visibility limited while data is often cross-pollinating, so I think it's going to work for me. Thanks for the bread crumb, led me down the right path! – Nathan Williams May 7 '14 at 2:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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