1
  • OWD for Account and Contract is Public Read-Only.

As we know that Account and Contract have Master-Detail relationship. Whenever a user creates Contract record the owner of the record is being automatically moved to the Account owner which is causing the creator to loose edit permissions on the contract record. Here my question is there any way so that the user who has the created the contract record has edit access on it.

3

Because of M-D relationship of the Account and Contract, if Account has Edit access then Contract will automatically have Edit access. As Contract is Detail object so ownership is governed by Account owner.

Best way to handle this is, when Account owner is getting changed then create a trigger to add previous owner as Account Team member of that Account and provide Read-Write Access and assign a team role. This way, previous owner will have Edit access to Account as well as Contracts.

Refer this Add a user as an account team member in all the accounts owned by another user to get a guidance. Here instead of all accounts you will add this to your specific account on which owner is getting changed.

One more thing, if you are performing mass insert of Contracts then probably you can get a locking error because of mass transfer of ownership, you have to think about that.

3

I would ideally write a Trigger on After Insert/After Update, and create ContractShare record with edit access.

But, You cannot create an Apex Sharing for Contract.

Also, Account and contracts are tightly coupled. Which means you have to give read-write access to Accounts to get Edit Access on contracts.

I would handle it using Sharing rule based on criteria and share Accounts with a small public group that can edit contracts.

Another approach will be To give modify All permission for Contracts at Profile or Permission Set level and keeping Account Permission as just Read. You can add validation rule to not allow the Users who are not contract creators to not edit contract.

  • But in my requirement users who should be able to edit Contracts are different from who edit Accounts. So is there any other way other than giving edit access on accounts. – Venky Jan 9 at 17:26
  • Updated answer with what possible. – Pranay Jaiswal Jan 9 at 17:29
  • As said in my question contract can only be in public read-only state. Giving Modify All permission for the contract will allow all the users with that profile to edit records created by others. – Venky Jan 9 at 17:33
  • Hi Venky, I answered with what's possible when you use Out of the box functionality. Usually you have to do trade-offs with a few things. As of now, it's not possible to have edit acces on Contract without having edit access on the account. I would happy to be wrong here, – Pranay Jaiswal Jan 9 at 17:37
  • Thanks Pranay for quick replies. I too found out those are the only ways from my dive into blogs and documentation but just out of curiosity and assuming i might have missed something else. Raised a question here. Anyways thanks for the help. – Venky Jan 9 at 17:44

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.