1

I have an opportunity where stagename(this is picklist) whenever equal to "closed won" and after that anyone change amount__c field or status__c field, it will throw error message that is "You cannot change status__c and amout__c field value when stagename is closed won" from validation rule how it will be done.

2 Answers 2

1

Validation rule: You cannot change status__c and amout__c field value when stagename is closed won

AND( 
    ISPICKVAL(StageName, "Closed Won"), 
    OR(
        ISCHANGED(amount__c), 
        ISCHANGED(status__c)
    )
)

Updates

You can use ISNEW() method to prevent this validation to fire in insert case

AND( 
    NOT(ISNEW()), /*it will be true only in update case*/
    ISPICKVAL(StageName, "Closed Won"), 
    OR(
        ISCHANGED(amount__c), 
        ISCHANGED(status__c)
    )
)
5
  • there is one problem like when i create a record then i have direct enter closed won and amount set 1000 USD. and then save it this time given an error you cannot change amout feild value. but first time i have save it will be save but not saving first time Oct 3, 2016 at 13:44
  • @cloudZigZag ahh what is usecase where you need to create opportunity with close won ?
    – Ratan Paul
    Oct 3, 2016 at 13:46
  • @cloudZigZag if you still want to do that they i will add the updates in my answer
    – Ratan Paul
    Oct 3, 2016 at 13:46
  • if i create an opportunity and directly set stagename closed won and set amount value like 1000 USD it will be saved (but it will throw validation error message but not to show first time)ok after that i'll update amount 1000 to 1500 that time error message appear you cannot change amount when stagename is closed won. bu Oct 3, 2016 at 13:48
  • @cloudZigZag check my updates..
    – Ratan Paul
    Oct 3, 2016 at 13:50
0

You can try below validation rule on Opportunity Object,

AND( 
ISPICKVAL(PRIORVALUE(StageName),"Closed Won"), 
ISCHANGED(Amount) 
)

You can check sample opportunity validation rules here

1
  • there is one problem like when i create a record then i have direct enter closed won and amount set 1000 USD. and then save it this time given an error you cannot change amout feild value. but first time i have save it will be save but not saving first time Oct 3, 2016 at 13:45

You must log in to answer this question.

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