1

I want to restrict updating the opportunity owner. I'm not able to use the validation rule because ISCHANGED( Owner.Id ) is not working. It's giving the following error, Error: The ISCHANGED function cannot reference the Owner.Id field.

When I use `ISCHANGED( OwnerId ) validation is not working. Below is my code

AND(  Region_of_Opportunity__c == 'US',
      Region_of_Opportunity__c == 'CANADA',
      Record_Type_Name__c != 'Advisors',
      Record_Type_Name__c != 'APT',
      Record_Type_Name__c != 'Vocalink',
      Record_Type_Name__c != 'Enterprise Partnership', 
      Record_Type_Name__c != 'Advisors - New Opportunity',
      ISCHANGED( OwnerId )      
) 

Please help me !!!

1
  • Is it possible for the Opportunity have a 'Region_of_Opportunity__c' value of US & Canada at the same time? Owner.Id will never work as you cannot cross-reference objects using IsChanged().
    – TSmith
    Commented Oct 11, 2018 at 8:27

3 Answers 3

4

You have two issues here.

  1. Understanding of how to use isChanged()
  2. Understanding conditional logic in validation rules

isChanged()

You are unable to cross-reference objects using this check. As you are on the Opportunity object, Owner.Id is an attempt to reference the User object. You must use OwnerId which is a lookup to the User object.

Conditional logic in validation rules

AND(  Region_of_Opportunity__c == 'US',
      Region_of_Opportunity__c == 'CANADA',
      Record_Type_Name__c != 'Advisors',
      Record_Type_Name__c != 'APT',
      Record_Type_Name__c != 'Vocalink',
      Record_Type_Name__c != 'Enterprise Partnership', 
      Record_Type_Name__c != 'Advisors - New Opportunity',
      ISCHANGED( OwnerId )      
) 

The above formula will never prevent the User from changing the Owner of Opportunity unless all conditions are met, which I believe is incorrect. You must use an OR condition within your AND.

AND(
    OR( Region_of_Opportunity__c == 'US',
        Region_of_Opportunity__c == 'CANADA'
    ),
    AND (
        OR( Record_Type_Name__c != 'Advisors',
            Record_Type_Name__c != 'APT',
            Record_Type_Name__c != 'Vocalink',
            Record_Type_Name__c != 'Enterprise Partnership', 
            Record_Type_Name__c != 'Advisors - New Opportunity'
        )
    ), ISCHANGED( OwnerId )      
)
0
0

a Similar validation worked for me. The only extra check I added was the NOT(ISNEW()). You could try adding that.

AND( NOT(ISNEW()), ISPICKVAL(LeadSource, 'Partner Referral'), ISCHANGED(OwnerId) )

0
0

Try the following formula -

AND(  
  OR(
      Region_of_Opportunity__c == 'US',
      Region_of_Opportunity__c == 'CANADA'
  ),
  OR(
      Record_Type_Name__c != 'Advisors',
      Record_Type_Name__c != 'APT',
      Record_Type_Name__c != 'Vocalink',
      Record_Type_Name__c != 'Enterprise Partnership', 
      Record_Type_Name__c != 'Advisors - New Opportunity'
  ),
  NOT(ISNEW()),
  ISCHANGED( OwnerId )     

)

1
  • Hi Naval, I must use use an OR condition within AND.
    – JURY
    Commented Oct 11, 2018 at 9:59

You must log in to answer this question.

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