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.

Filter by
Sorted by
Tagged with
0
votes
1answer
131 views

Why Apex Sharing [closed]

I am getting confused when we need apex sharing. Sales-force has Sharing rules(criteria,owner-based,manual),so what is the use of Apex sharing. Somebody please provide usecase/example when we need ...
1
vote
1answer
1k views

Communities - sharing options

At the moment we have a customer portal and we are looking to move to communities. The Customer Community license and the Customer Community Plus license offer different options for the sharing of the ...
1
vote
2answers
1k views

Apex Sharing Delete for Account

I have created two fields Assign Rep and Sales Manager which is having lookup with User in Account Object. I am sharing records using Apex. I have written one trigger for that. Now the problem is if I ...
1
vote
1answer
601 views

Customer Community Using Apex Sharing [duplicate]

I am trying record sharing through apex. But when i am giving sharing setting to Customer Community User it is throwing this exception FIELD_INTEGRITY_EXCEPTION, field integrity exception: unknown ...
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
1k views

Edit Permission on Field with Particular Record Type for Selected Users

Want to do : Give Edit permissions for "Field1__c" on only Record Type = "Record_Type1" for Standard object to particular users (u1, u2,u3) only. All other users will Read Only for that field on ...
1
vote
1answer
605 views

Enable apex sharing reason

The apex sharing reason related list is absent in the object setting page. How to enable apex sharing reason in a sandbox. This is a detail object in a master detail relationship. Thanks in advance.
0
votes
1answer
65 views

Share record behaviour

On a learning perspective, how does the sharing records work when it comes to apex based sharing. For a given user and given record, can there be multiple share records of the same access level. Can ...
1
vote
1answer
330 views

Records sharing using Apex - [Records are inserted successfully but do not reflect in __share table]

Today I have encountered a wierd problem while sharing the records through Apex. Appreciate if someone can help me understand the root cause or faced the similar issue earlier. Flow of the Code is : ...
0
votes
1answer
145 views

Insufficient privileges for sharing projects

I have a button to share projects but if the user isn't a sysadmin, neither ownerid, neither has the 'ModifyAllRecords' permissions, system shows an error message Insert failed. First exception on ...
1
vote
1answer
1k views

DML operation INSERT not allowed on CaseShare when deploying from Developer Sandbox to Developer Pro

I have this case trigger handler, works fine in sandbox: CaseShare[] casesShar = new CaseShare[]{}; for (case c: cs){ if(c.OwnerId!=null && oldCaseMap.get(c....
1
vote
1answer
520 views

How can we share a pricebook record to a group using apex code

I want to share record of Pricebook to a group. Their is no object called PricebookShare, how can we share if there is no object PricebookShare to share? Is there any way? Please guide me.
1
vote
1answer
575 views

case share records are not visible in caseshare table

I have added case share using manual share(apex programming) and I could see the id from the case share table in debug logs after insert. I have verified everything including users access(community ...
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 ...
1
vote
1answer
3k views

Error : Insert Failed :INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, Sharing Rule Trigger

I have created one Trigger to give access to particular Accounts of my "Special" custom object records, Here BBB : Is custom object having lookup of both Account and Special E.g. BBBRecord = ( ...
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 ...
6
votes
1answer
3k views

Query a custom object's “__Share” in subquery

Is it possible to use a subquery to obtain a list of that object's __Share's? For example: ObjA has been manually shared via apex. At some point I may want to query information about ObjA and get a ...
1
vote
2answers
508 views

custom extension has without sharing annotation but still runs in user mode

I have created a custom controller that extends a standard controller. My custom extension is defined 'without sharing'. Nevertheless, it seems to execute 'with sharing'. I get the feeling that an ...
8
votes
1answer
5k views

FIELD_INTEGRITY_EXCEPTION: field integrity exception: unknown (invalid user or group: 005XXXXXXXXXXXX)

I've a object called myobject__c. This object is private in OWD Setting. Now when admin create a new record of this object then I want to share this record with a user(community user). For this I've ...
6
votes
1answer
217 views

System.UnexpectedException: Read of id returned an invalid id '000000000000000'

Since a few days ago a some methods in one test class started to fail with this exception System.UnexpectedException: Read of id returned an invalid id '000000000000000' What is more interesting ...
2
votes
1answer
447 views

without sharing returning data to with sharing class

Currently, I have a little VF report that certain users can run. If the controller is specified as with sharing and it queries for data elsewhere that uses without sharing and returns it, can I ...
1
vote
1answer
401 views

error: Unable to change sharing model because sharing objects are referenced by the following components

I'm developing a managed package which has some apex sharing functionality built into it. In the customer test org I'm attempting to set one of the referenced objects to be public read/write instead ...
5
votes
2answers
2k views

Is is possible to grant delete permissions using apex managed sharing?

I have Custom_Object__c with: Org-Wide Default Settings as: Private Object Permissions in the user Profile: Create, Read, Edit, Delete. I have a small development in Apex that is creating some apex ...
3
votes
1answer
629 views

what permissions are necessary to be able to create apex sharing rules for a record?

I have a test user that has permission to a specific record but cannot create an apex managed sharing record for the given record. What additional permissions are necessary to be able to create a ...
3
votes
1answer
346 views

Users able to circumvent sharing for custom object on visualforce page

We have an object which has private sharing settings. There are no sharing rules on the custom object. But if the user(not owner of the record) knows the Id and paste it in the browser ..he is able to ...
13
votes
2answers
7k views

Communities Sharing Rules with Partner level access

So Im a little confused about the best way to share content within a salesforce community. We have a number of custom objects with content owned by community members, and our hope is to create "...