+ Start a Discussion
deepakMdeepakM 

Validation rule for stage change.

hi every one

 

i have two user.

1. admin

2. test

 

if the stage is completed then the user test unable to change the opportunity stage if the stage is "completed" only admin can change it.

For that i created the validation rule but it not work

 

AND ( 
ISPICKVAL(StageName, "Completed") 
, $User.ProfileId != "056560000666")

}

 

here this is admin prfofile id 056560000666.

 

But it not work.

 

please guide me.

 

thanks

Best Answer chosen by Admin (Salesforce Developers) 
deepakMdeepakM

AND( 
TEXT(PRIORVALUE(StageName) )== "Completed", 
ISCHANGED( StageName), 
$User.ProfileId != "00ed0000000vQrA" 

)

All Answers

SFDCStarSFDCStar

Deepak,

 

Try below validation

 

AND( ISCHANGED( StageName ),   !ISPICKVAL( StageName , 'Completed'),  $Profile.Name  = 'Test'  )

 

If it helps mark as solution.

 

Thanks,

Pandu

clouduserclouduser

please try this...it is working

AND(ISPICKVAL( StageName , "Completed"), $User.ProfileId <> '056560000666')

deepakMdeepakM

i used this 

 

AND( ISCHANGED( StageName ), !ISPICKVAL( StageName , 'Completed'), $Profile.Name != 'System Administrator' )

 

but it not work as suppose the stage is search even though the other user unable to change the stage ,as i need only when the opp stage is completed by admin and than other user unable to change the stage to other( as it is completed by admin) only admin can change it

 

thanks

 

deepakMdeepakM

this not work as i already used this.

 

Actually my senario is suppose the opp name is Testopp and admin change the stage to Completed,thn if other user other thn admin login and going to change the stage to other it can't.

but if the opp satge is other thn completed thn the user can change the stage.

 

thanks

SFDCStarSFDCStar

Below both are worked for me 

 

--> AND( ISCHANGED( StageName ),   !ISPICKVAL( StageName , 'Closed Won'),  $Profile.Name    <>   'System Administrator'  )

 

--> AND( ISCHANGED( StageName ),   !ISPICKVAL( StageName , 'Closed Won'),  $Profile.Name    !=  'System Administrator'  )

 

If doesn't work, give me more info.

deepakMdeepakM

i have this formula

 

AND
(
TEXT(StageName) == "Completed",
ISCHANGED(StageName),
$User.ProfileId <> '00ed0000000vQrA'
)

 

########

This give the presenet picklist value that i required TEXT(StageName)

next ISCHANGED mean that picklist value changed.

 

these are the some senario i needed but i dont knw how to combine both the senario with the user profileid ,so it work.

 

Any idea ,please suggest.

 

Thanks

 

deepakMdeepakM

i used this 

 

AND( ISCHANGED( StageName ), !ISPICKVAL( StageName , 'Completed'), $Profile.Name != 'System Administrator' )

 

but it not allow the user to change the stage if it is other thn completed also which i dont require.i need only when the stage is completed thn the user not change the stage not for other stage.

 

thanks

deepakMdeepakM

AND( 
TEXT(PRIORVALUE(StageName) )== "Completed", 
ISCHANGED( StageName), 
$User.ProfileId != "00ed0000000vQrA" 

)

This was selected as the best answer