function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jayaramu T 9Jayaramu T 9 

can any one please help me on this, Detail a solution for the following ?

On the Opportunity object, prevent non-admin users from modify the Opportunity Name once Probability is greater than 50% and prevent Opportunity from being deleted if Probability greater than or equal to 75% (Please show code as necessary)
Vinod ChoudharyVinod Choudhary
The following Validation Rule will only allow users edit closed opportunities if they are assigned to a Profile ID listed (example is System Administrator "00et0000000q111" or Sales VP "00et0000000q222") will be able to edit the Opportunity.

AND(
PRIORVALUE( IsClosed ) = True,
NOT(OR(
$Profile.Id = "00et0000000q111",
$Profile.Id = "00et0000000q222"))
)

you need to change the code according to your requirenments
AshishkAshishk
Write trigger for both validations :-
 
trigger ValidateOppty on Opportunity (before update, before delete){
   for (Opportunity p:Trigger.new){
     if (Trigger.isUpdate && (p.Probability >= 50)&&(!Profile.contains(UserInfo.getProfileId()))
&& Trigger.oldMap.get(p.id).Name!=p.name){
         addError('you cannot change name now');
     }

     if (Trigger.isDelete && (p.Probability >= 75)&&(!Profile.contains(UserInfo.getProfileId()))){
         addError('you cannot delete oppty');
     }
   }
Where profile is a string, containing admin profile ids separated by commas. You can keep that in custom setting and access that in trigger.