Here is my scenario,

enter image description here

GroupAccount - (ORG wide READ permission)

  • A custom object which is parent object of Account (standard)
  • One GA can have many Accounts

Account - (ORG wide - Private)(Has sharing rules)

Document__c A custom object which has Many to Many relationship with Group Account Object

GroupAccount_Document__c A junction object with many to many relationship between GroupAccount and Document__c

Requirement When user goes to view GroupAccount data then i should be able to show Document__c records based on the below condition - All Document records related to that GroupAccount if User has access to even one Account Record of that GroupAccount

My questions are - How to implement Sharing rules for this scenario. For e.g. if i run a SOQL like "Select documents from GroupAccount junction object where GroupAccount=XXX" then user should get documents related to this GroupAccount only if he has access to one of Accounts of that GroupAccount

I have updated my question based on change in design. I am not a Salesforce expert so excuse me if my question is dumb.

  • I assume your "Accounts" is the standard Account object, You do not have access to Document__c via the junction object (Until its master detail) or you cannot control access to Account through groupAccount__c, I suggest you can use apex manage sharing to dynamically share the records on certain conditions. – Hasantha Oct 22 '15 at 1:40
  • If you are talking about SOQL query as you mentioned in your comment SELECT Document from account.... Apex runs on system context and it will return the data based on this you can use apex sharing rule to share the data with any user. – MIX DML Oct 22 '15 at 2:57

Your Answer

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

Browse other questions tagged or ask your own question.