The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [apex-sharing]

Granting permission to User/Group of Users via Apex.

25 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
109 views

Apex Sharing to multiple individual users throws duplicate row error

Scenario I have Community users that I need to share some account records to, where the Account that the Community user is linked to is referenced by a lookup field on the Account record to share.I ...
1
vote
0answers
68 views

Community Sharing set field mapping

I am trying to work with Community sets and I am facing the following issues. I had created some sharing User:Contact = Case:Parent.Some_Lookup_Field__c and records were successfully shared I changed ...
1
vote
1answer
199 views

Share Pricebook record to the current user using Apex trigger or class or Flow

If there any Option to share the newly created Pricebook using Apex class to Current user. We have separate object(Opportunity Share) for Opportunity sharing like that do we have any object to share ...
1
vote
0answers
202 views

Error while sharing Records with Apex sharing

I have two objects, pld and lead (relationship is such that lead is a parent and pld is child). When I'm changing the owner of pld objects then I want to share the lead with new owner of pld object, ...
1
vote
1answer
182 views

Want to share custom object records with Partner Community Users based on User's custom field

My custom object and User object, both are having a custom field named as State, I want to share custom object records with only those users who match with the State of the custom object's record. I ...
0
votes
0answers
8 views

Hide lead records from global search and list view including system admin

I have implemented lead conversion from apex class. I have done that correctly. But after the conversion I want to archive the lead(Hide the lead from list view). In standard lead conversion ...
0
votes
0answers
23 views

SharingRule is not being shown as RowCause in OpportunityShare record

I have granted a User access to an Opportunity record through an Opportunity sharing rule. Now I can see in the UserRecordAccess Object that the User has access to this particular Opportunity record. ...
0
votes
0answers
28 views

Apex Managed Sharing fails sharing Case with Community Plus user

Scenario: A 'Customer Community' License user logs into a community and creates a case, which is automatically assigned to a queue. A trigger on case invokes a future method (of a class declared ...
0
votes
0answers
68 views

Apex Sharing : AccountShare ImplicitParent

I am querying below AccountShare records - Select Id,AccountAccessLevel,Account.Name,RowCause,UserOrGroupId from AccountShare where UserOrGroupId='some_id' I am getting 2 records in which ...
0
votes
0answers
35 views

Permission Error when Auto-Sharing Salesforce File with Apex Trigger

I am trying to create an Apex trigger that automatically shares an attached Salesforce File with a user related to the record upon which the File was uploaded. I believe I have created a working code ...
0
votes
0answers
142 views

Sharing records through apex with Public Group

I am sharing Opportunity records through OpportunityShare from Apex with Public Groups. When i checked the sharing button the record is being shared with that Group but after logging in as that user ...
0
votes
0answers
281 views

TooManyLockFailure : Too many lock failure 200 Trying again later

I have a requirement to provide a particular group of records to one user.But record sharing criteria depends on formula field. So, I'm not able to share through sharing rules. So, I have created an ...
0
votes
1answer
126 views

Assign RowCause for Dynamic sOBject

I am trying to make an Apex controller that can work with any sObject. I cannot add Row cause for manual records though. Any help: // Create new sharing object for the custom object Job....
0
votes
0answers
177 views

Sharing Case Records with Customer Community Users

We have set up the community in Salesforce and business use case is that whenever the case raises from the external user and assigned it to an internal user for resolution than any action or updates ...
0
votes
0answers
153 views

How the Custom Apex Sharing works in salesforce?

In my org, Case OWD is Private and Case has two child objects (Transaction1 and Transaction2) whose OWD is Private too. Transaction-1 and Transaction-2 object has lookup relationship with Case. I ...
0
votes
1answer
641 views

field integrity exception: RowCause (Specified value is reserved and cannot be used)

I have a OWD Case is Private and its child Object (Payment also Private). I have Lookup relationship with Case and Payment object.. When Case is created its owner will changed as per the Case ...
0
votes
1answer
100 views

Unable to access Contactshare records in test class as customer community plus portal user

Our contact OWD is Private When we convert an existing contact as a customer community plus user, he gets read only access to his own contact with the sharing reason 'Associated Portal User or Role '(...
0
votes
0answers
306 views

How to create Apex Case Sharing Rule in Partner Community

I have the following code which creates a CaseShare for a Partner Community User to share all cases across an Account. The UserOrGroupId is set to the Group of type 'RoleAndSubordinates' that is ...
0
votes
2answers
137 views

How to pull the Share table from a Lead and insert it into a Contact when the lead gets merged to that Contact

When a lead gets converted, if it has a contact with the same name, it gets merged using Dupeblocker. The share table from the lead gets lost, I'm trying to copy that table and insert it into the ...
0
votes
1answer
71 views

Opportunity records are shared with users automatically

We are using a Visualforce page for creating Opportunity records. The Opportunity OWD is set to Private.We have salespersons field(users) being set on Opportunity Page while creating Opportunity. The ...
0
votes
1answer
296 views

Partly sharing detail records of a master-detail relationship

In our data model, we have several objects that are details of account (master-detail) relationship. I want a profile to have access to the records of Object A and B if they are the owner of the ...
0
votes
1answer
178 views

Deleting a Shared Record using Apex Sharing

We have a requirement where a particular record of an Application object should be shared to either an assigned representative or a Sales Manager. These are two fields which are created on Application ...
0
votes
1answer
527 views

Selectively Deleting sharing rules

Hi guys I am trying to delete sharing rules on a custom object (say myCustOb__cj) based on if the user is a portal/community user or an internal user. If the user is a portal user then delete the ...
0
votes
1answer
359 views

Able to perform DML operation on Read only object from trigger running with sharing

I have a trigger which runs with sharing. All I am doing in this class is updating or inserting another sObject on afterInsert or afterUpdate. Trigger is running in system context Profile/user used ...
0
votes
0answers
840 views

AccountShare record not able to query with UserOrGroupId as filter, when rowcause is 'Rule'

Tried to query AccountShare record with UserOrGroupId as filter, this works good for all RowCause except 'Rule'. I tried to filter the above query with UserOrGroupId with RowCause as Owner, its ...