0

I have written a new opportunity page but I am using native(standard) Edit functionality of the opportunity object. The scenario is I shared an opportunity with a user X, using apex code and granted him "Edit" right on a opportunity, lets say Y.

Now if i run below query on OpportunityShare object, i get "Edit" OpportunityAccessLevel on the opportunity Y for user X.

select OpportunityAccessLevel from OpportunityShare WHERE UserOrGroupId ='X' AND OpportunityId ='Y'

The Edit button is not visible for user X and if he tries to save the opportunity record he gets "Insufficient Access".

I am not able to understand what is wrong in this. Am i missing something?

  • Can user X edit the Opportunity using the standard page layout? – Mike Chale Sep 17 '13 at 13:09
  • No. He can't edit the opportunity but i think he should be as i have shared opportunity with him. – Pramod Kumar Sep 17 '13 at 13:30
  • Does his profile have Edit on Opportunity? Does he have access to that Record Type, if you're using Record Types? – Mike Chale Sep 17 '13 at 13:40
  • No his profile don't have Edit on opportunity that's why i used sharing. no i am not using record type – Pramod Kumar Sep 17 '13 at 13:50
3

The issue is that he doesn't have edit access on Opportunity. Sharing only determines which opportunities he can access, not the permission he has on the object itself. Their profile needs edit permissions for the opportunity.

See this interesting blog on the subject, it should shed some light on this.

http://blogs.developerforce.com/engineering/2010/11/crud-fls-and-sharing.html

  • So how can i grant edit permission on a record to a user if his profile doesn't have edit permission on that object. – Pramod Kumar Sep 17 '13 at 17:09
  • If you dont want to enable the permission for the profile, you can create a permission set that grants the edit right to Opportunities and assign it to that user – Chris Duncombe Sep 17 '13 at 17:12
  • ok got your point. one more thing what would happen if user X profile has edit permission on opportunity Y but at the time of sharing X opportunity with user X i set OpportunityAccessLevel = Read. Would user X be able to edit opportunity X? – Pramod Kumar Sep 17 '13 at 17:23
  • I think your confusing sharing with permissions. A person has Edit permission on an object globally. you can then use sharing to limit which instances of that object they have access to. So if you have a user that only has read access, no amount of sharing rule configuring will allow them to edit that object. – Chris Duncombe Sep 17 '13 at 17:27
  • now it is clear to me. Thank you very much and sorry for asking too many questions. – Pramod Kumar Sep 17 '13 at 17:31

Your Answer

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

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