0

I created a checkbox field on User Table named Can Unlock. I have a requirement based on this field I have to lock all opportunities for any particular user. can some help?

5
  • what is OWD of Opportunity? Mar 16, 2019 at 19:03
  • Public Read/Write
    – Sam
    Mar 17, 2019 at 13:15
  • Have you looked into using a Validation Rule? salesforce.stackexchange.com/questions/126253/… Mar 17, 2019 at 19:26
  • That solution is depend upon System Admin Profile. My requirement is based on Specific User with a checkbox field.
    – Sam
    Mar 20, 2019 at 7:58
  • @Sam The solution David Cheng linked - in Robin de Bondt's answer - can be adapted for any Profile or to use a Custom Permission.
    – David Reed
    Mar 20, 2019 at 12:21

1 Answer 1

0

You can create a Permission set with a name like 'Lock Opportunities'. And whenever your 'Lock' field on a specific user is ticked. Using Apex add a user to that permission set [In which Opportunity object has read-only access]. And if 'Lock' is removed from the user. You can remove that user from the Permission set using apex. All you need is a Combo of Trigger and Apex Class to drive this functionality.

1
  • Hi Vivek, Thanks for response. I created a trigger and an associate class. Also created a permission Set. But don't know this is not working. I am attaching my code snippet.
    – Sam
    Mar 20, 2019 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .