I am trying to restrict users by profile from being able to delete opp line itmes. For example I have a communities partner profile and under the standard object permissions against the opportunity (master record of the line item) there is no box to either allow or disallow delete rights.

enter image description here

If I login as one of these users and look at the list view of opportunities there is no delete option - this is correct.

If we look at the corresponding list of opp line items they do have the delete option so this is not consistant.

enter image description here

This problem is not specific to partners user profiles either, I checked a standard profile and the delete option for the opp is explicitly not ticked yet they also can delete the line items.

I understood that the edit/delete rights to the master object should also apply to the detail records.

How can I configure the settings to restrict certain profiles from being able to delete both the opportunity and its individual line items?

If its not possible in the settings then we will do it with a before delete trigger and only allow a few admin profiles but I would assume a basic permission like this can be done without any code.


This issue is addressed on the Salesforce Success Forum

  1. Create RSF field on Opportunity OpportunityProductCount__c that is a count of all Opportunity Products on the Opportunity
  2. Create a Validation Rule on Opportunity:

    AND(PRIORVALUE(OpportunityProductCount__c) > OpportunityProductCount__c,
        $Profile.name = 'Foo')

You can do two thing- 1. Open a case to have the delete function disable for certain standard profile. Or 2. make a validation rule or trigger to display error when a user with certain profile delete a opp line.

  • Do you think this is a bug in salesforce then, that the delete rights are not inherited from the opportunity to the line item? Mar 8 '16 at 17:19
  • I'd be astonished if Salesforce Support would enable this on Opportunity Product
    – cropredy
    Mar 9 '16 at 1:47
  • You can't use Validation Rule on delete operations.
    – Adrian Larson
    Mar 9 '16 at 1:47

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.