1

trying to add and OR syntax into my formula.

AND((Name <> Contact__r.LastName + " - " + Term__r.Name), OR(Record_Type_Hidden__c <> "New_Agent",Record_Type_Hidden__c <> "Renewing_Agent"))

When I remove the OR and just include the one record type it works but I need it to check one or the other record type

This WFT is on the Opportunity Object. I'm trying to get the formula to only trigger when the Opp Name is not Lastname - term and record type does not equal New_Agent of Renewal Agent

1
  • 1
    What exactly are you trying to do? Can you edit your question to explain the objective? What is the WFR is supposed to do and what is it actually doing? Aug 14, 2019 at 15:21

1 Answer 1

3

This OR clause:

OR(Record_Type_Hidden__c <> "New_Agent",Record_Type_Hidden__c <> "Renewing_Agent")

will always be TRUE:

  • If Record_Type_Hidden__c is "New_Agent", then it is not equal to "Renewing_Agent" and the clause is TRUE.
  • If Record_Type_Hidden__c is "Renewing_Agent", then it is not equal to "New_Agent" and the clause is TRUE.
  • If Record_Type_Hidden__c is neither "Renewing_Agent" or "New_Agent", then the clause is TRUE.

If what you want is for the Workflow to fire on all record types except these two, then you don't want the OR() at all - just include both in the AND():

AND((Name <> Contact__r.LastName + " - " + Term__r.Name), Record_Type_Hidden__c <> "New_Agent",Record_Type_Hidden__c <> "Renewing_Agent")

If you want to fire on just those two record types, leave the OR(), but reverse your comparison operator:

AND((Name <> Contact__r.LastName + " - " + Term__r.Name), OR(Record_Type_Hidden__c = "New_Agent",Record_Type_Hidden__c = "Renewing_Agent"))

4
  • removing the OR() worked thank you. I'm still not understanding why though and I've read your explanation a few times. If I don't want the WFR to trigger if the Opp Name is not equal to LastName+term and Record Type is not equal New_agent OR Renewal Agent. How is AND(1,2,3) working? I thought AND() requires that all must be true to trigger which is why AND(1,(2 OR 3)). What am I not understanding? Aug 14, 2019 at 16:02
  • You want all three conditions to be true: that the Opp Name is not equal to the pattern, and that the record type is not New_Agent and that the record type is not Renewal_Agent. That two of the conditions relate to the same field is what makes your mind think of "or" - you don't want Record Type to be A OR B. But they're really separate conditions, and you want all of them to be true, so AND() is what you need. Aug 14, 2019 at 16:08
  • 1
    Oh! ok got it now thank you again, sir. The extra explanation was very much appreciated. I'm a big believer in teach a person to fish :) Now I understand for next time. Aug 14, 2019 at 16:14
  • PS: If an answer is correct, it's usually also worth an upvote. Aug 14, 2019 at 16:14

You must log in to answer this question.

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