Questions tagged [apex-managed-sharing]

Apex Managed Sharing is the act of granting a user or group of users permission to perform a set of actions on a record or set of records. Sharing access can be granted using the Salesforce user interface and Force.com, or programmatically using Apex.

Filter by
Sorted by
Tagged with
1
vote
0answers
15 views

Share record on basis of sharing of lookup object [on hold]

We have Quote object looking up to opportunity in our Org. We want to set sharing of Quote object to Private. The sharing of the Quote record should be same as of opportunity. We are planning to ...
-1
votes
1answer
29 views

How to Unshare Record By using shared date

I want to Unshare records by Query which I shared 1 month ago. List<CustomObject> rec = [SELECT Id, CreatedDate FROM CustomObject WHERE CreatedDate <Whatever Date]; How I can get Shared ...
0
votes
0answers
19 views

Cannot find records in OpportunityShare

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
2answers
120 views

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY on Apex Sharing Insert

I'm getting this exception when inserting to the Share table of a custom object. I've mirrored the code on document here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/...
1
vote
2answers
17 views

Edit Default Sharing Settings of a Share Object

As per the title I am wondering if it is possible to edit the default sharing settings for a particular Share object. For instance I would like to give a group of users edit access to the CaseShare ...
1
vote
1answer
42 views

Salesforce Managed package can't push

I can't push managed package bcoz I've deleted few unwanted classes from it and rebuild the package now whenever I try to push this new uploaded package it went fail and ask me for deleted class bcoz ...
1
vote
0answers
78 views

Apex Sharing of Case to All Internal Users

I am having an issue whereby I have created an Apex method to create a CaseShare record for a particular case. The manual share record provides Read access to the standard group "All Internal Users: ...
0
votes
0answers
27 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
22 views

User cannot see “Shares” relationship on Case [duplicate]

I'm trying to use Apex Managed Sharing to create share records when a record is created, but I'm running into a bit of an issue when Customer Community Plus Login Users create the records... A user ...
3
votes
1answer
99 views

APEX Sharing stopped working in community

We had a small widget that allowed customers to share records that were set to a private sharing model in our community. Everything was rather simple and it would simply allow them to select users ...
2
votes
0answers
140 views

Delete __Sharing object

I'm receiving the following error: TR09_MasterServiceAgreement: execution of AfterInsert caused by: System.DmlException: Delete failed. First exception on row 0 with id 02c1800002Lir2PAAR; ...
4
votes
2answers
95 views

Is there a typesafe way to work with rowCause?

On the project I'm currently working with, we have Apex Sharing Rules. I see we are passing rowCause as a String everywhere. But the values of these Strings look like API names. Is there a typesafe ...
2
votes
0answers
34 views

Apex sharing insert

We are now investigating some performance issues for the client and trying to speed up their processes. One of the time consuming parts is apex sharing that we have there. I am pretty sure that some ...
6
votes
3answers
205 views

Question related to sharing

Below is our scenario We have a custom case object. where ownership is based on queues. Users are assigned to queues and any user part of a queue gets access to all the cases assigned to the ...
1
vote
0answers
23 views

Sharing records without the ability to report the same

We have the below scenario for the partner users: 1) They should be able to view their own data. (they are not the owners of the record, but it is explicitly shared to them). 2) The should ...
-2
votes
1answer
31 views

Sharing Rule to share custom Obj [closed]

I haven't worked on Sharing Rule Before can anyone please help me. I want to share 'Story' custom Object. When Share checkbox is checked, share Story record with Role and Hierarchy - Exec Director ...
1
vote
2answers
229 views

What are the Apex Managed sharing best practice for a large number of records

I have a question about Apex Managed Sharing best practices. We have a use case where we would need to create thousands of Apex Sharing records for each user. I was wondering would it be better to ...
1
vote
1answer
41 views

Record Sharing Salesforce

Below trigger is giving error while creating sharing records, can some suggests where is the issue. Sharing setting is set to private for external user on this object. Error: AccessLevel (trivial ...
2
votes
2answers
192 views

Create Custom Object Share record as Community User

Similar to this question, I cannot create a CustomObject__Share record as a Community User (Customer Community License). Taking the advice provided there, I have created a Share__c object that ...
1
vote
0answers
267 views

Apex case sharing for customer community users

I'm hoping someone can help me understand the best way to approach the following requirement? Requirement: allow community users on different accounts to share cases with one another. Current Setup: ...
0
votes
0answers
139 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 ...
1
vote
0answers
22 views

Is there a way to remove sharing of records implemented via apex? [duplicate]

I want to rollback the sharing of records implemented by creating OpportunityShare records via apex code. Initially, I had assigned specific users access to the Opportunity records, but on testing it, ...
5
votes
1answer
273 views

Recalculating Apex Managed Sharing

I am studying "Apex Managed Sharing" but I have a problem with "Recalculating Apex Managed Sharing". The Apex Developer Guide says: Every time a custom object's organization-wide sharing default ...
1
vote
1answer
39 views

Fate of unsupported Lightning features?

Has Salesforce has said anything (officially or unofficially) about whether or not Lightning will support the below features that currently you have to switch back to Classic to manage? I have not ...
2
votes
1answer
676 views

Sharing records from Customer Community user to Customer Community Plus users

In our org we have a customer community with both Customer Community (Login) license users and Customer Community Plus users. We want to give those users access to some objects related to their ...
1
vote
1answer
162 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
1answer
81 views

Can't remove Apex Sharing reason from managed package. Why?

In my managed package I had a CustomObject__c with an Apex Sharing reason. I now want to delete the object from the package. But I can't. Because I need to delete the Sharing reasons before. Which I ...
0
votes
1answer
310 views

How do I share a User's records with its subordinates?

I have a use case where the default sharing for an Object is set to "Private". When a user creates a new record, however, they want their subordinates to be able to work with it as well. It's a ...
3
votes
1answer
155 views

How can we maintain access to the creator a Case at all times, even when its owner has been changed to Queue

I had written a Workflow rule based on which a case gets auto-assigned to a "Customer Service Representative" queue. Now the problem is that as soon as the case is created, the creator gets ...
0
votes
1answer
470 views

Check for login User permission access in Lightning

Currently I am trying to share a record manually using Lightning components. As a owner Admin is able to share a record with User A User A is not able to share a record with User B Our requirement ...
0
votes
2answers
121 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
345 views

Unable to insert record into AccountShare object using High Volume Portal User

Scenario: We have a client portal enabled using Napili communities. They use ‘Customer Community Login User’ license. We also have another set of users who use are supervisors and they also use the ...
0
votes
1answer
541 views

What is a “sharing group associated with a role”

I'm working with Apex Managed Sharing and in the developer guide here for a "UserOrGroupId" it mentions: a public group or a sharing group associated with a role I can't find anything to explain ...
1
vote
1answer
93 views

Is is possible to grant delete permissions using apex managed sharing in Summer '17?

I tried to follow the Answer from this Question: Is is possible to grant delete permissions using apex managed sharing? I have an Apex Managed Sharing with 'edit' for the public group the user is in ...
0
votes
1answer
42 views

How to share access of a private child to same access as parent, without using master-detail?

Given my object relationship below, how (without using master-detail between media and account) would I solve the need to share Media__c in a private Media__c model such that access to Media mimics/...
0
votes
1answer
65 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 ...
2
votes
2answers
918 views

Guest User (Site) Access to a specific standard record

By default Salesforce allows the guest user to be granted 'Create' and 'Read' sharing access to standard object records (for the purpose of this question, let's consider Account). It makes sense that ...
0
votes
1answer
347 views

Unable to deploy Apex-based sharing code due to sObject Type not Supported

I am trying to deploy some Apex-based sharing. Everything works fine in sandbox and code is 100% covered. I have a set of contacts (with a related User field) and a set of Project Task records (a ...
2
votes
1answer
531 views

Why can't I create this AccountShare in a community?

Here's the scenario. Customer Community user creates a record. A trigger fires, calls into a without sharing class which inserts an AccountShare record. AccountShare is not accessible to community ...
0
votes
0answers
152 views

How to manage sharing rules in apex?

I am currently learning Salesforce. And I`ve got the task on courses about apex managed sharing rules. I need to use 3 standard objects - Account, Contact, User and 3 custom - Terr(as a territory), ...
1
vote
0answers
222 views

Question on Lead record sharing with Partners in the Partner Community

Use case detail: Partners can create Leads and view Leads that are assigned to the Partner thru the Partner Community Partner creates a Lead (e.g. Dan Cook) Partner has visibility to the Lead due ...
4
votes
1answer
333 views

What exactly happens when a share record is inserted?

We have apex sharing all over our project. When we developed and tested it in a Developer sandbox everything went nice and smooth. Now, in full sandbox this apex sharing seems to be the bottleneck. It ...
0
votes
1answer
594 views

Creating sharing rules through apex not manual sharing

Is it feasible to create sharing rules through apex , not manual sharing of records? Can someone please let me know if that can be done?
0
votes
1answer
267 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 ...
3
votes
1answer
19 views

Is there any possibilty in salesforce to access higher role persons records

In salesforce , by any means, can we provide access for lower profile persons to access higher profile persons records. Whether can we do this by using "Apex Based Sharing" ?
0
votes
1answer
29 views

Will there is always one record exist for share?

i fetch the share record using below soql List<sObject>shareList = new List<sObject>(); For( Test1__c primaryRecord : [select id , (select id from shares) from Test1__c]) Then i am ...
0
votes
2answers
395 views

Best way to share among multiple Roles/Profiles

Scenario: I have a requirement where I need to share records of some custom objects with users whose role could be anything say like region wise sharing. What could be the best way, till now in my org ...
2
votes
1answer
96 views

Advice regarding Apex Sharing on many objects

I developed a complex app with 25 objects all related to a single person. I initially developed the relationships as a Master-Detail hierarchy however it became apparent that the not being able to ...
1
vote
1answer
110 views

CaseShare created by partner record disappears

I am trying to beat this old problem of being unable to share partner cases with it's sibling partner users. I've implemented Apex managed sharing, but facing odd behaviour. I can see in debug log ...
3
votes
1answer
370 views

Is the OpportunityShare.RowCause available for changes through the API?

According to the documentation on OpportunityShare about RowCause: You can create a value for this field in API versions 32.0 and later with the correct organization-wide sharing settings. ...