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
JaxBeachJaxBeach 

Help with a function field

Ok, so I'm totally making this up as I go along, but am terrible with syntax and can't figure out how to do it.

 

IF(Account_Manager__c = "Erik Belsom" || "Darin Fulks" || "Joe Reynolds" || "Kevin Degel" || "Mike Reichenbach" || "Shawn Mayfield" || "Ted Drysdale" || "Shannon Couch", "Central",
IF(Account_Manager__c = "Frank Harden" || "Jennifer Johnson" || "Mary Bateman" || "Rick Beaman" || "Tim Boyle", "West",
IF(Account_Manager__c = "Bill Lacaillade" || "David Pennington" || "Dominick Provisiero" || "Howard Johnson" || "Jacques Shelton" || "Kevin Boucher" || "Mark Brown" || "Joe Reynolds" || "Stacey Petyak" || "Tom Bracy" || "Travis Cronk" || "Nicholas Gorsky","East", null
)
)
)

I'm trying to return a region area if the field contains any of the listed names - we have 3 different regions.  It was expecting a boolean and received text - sorry I don't my my boolean from my ......

Jeff MayJeff May

you are so, so close.  Here's the pattern...

 

IF(OR(Account_Manager__c = "Erik Belsom",Account_Manager__c = "Darin Fulks", Account_Manager__c =  "Joe Reynolds", Account_Manager__c = "Kevin Degel", Account_Manager__c =  "Mike Reichenbach", Account_Manager__c = "Shawn Mayfield", Account_Manager__c = "Ted Drysdale",Account_Manager__c = "Shannon Couch"), "Central",

 

JaxBeachJaxBeach

Thanks Jeff, that works when I do the one territory for central, but when I try and duplicate it to add the East and West regions I get a syntax error - do you know how I would combine IF statements?  Could I do &&?

Jeff MayJeff May
To combine them, just add the next IF() as the 'false' of the first one. (spaces added for clarity) IF(A=1 , 1, IF(A=2, 2, IF(A=3, 3, 0) ) )
JaxBeachJaxBeach

When I do that I get a syntax error stating I'm missing a ), but I count 6 on the right and 6 on the left

 

IF(OR(Account_Manager__c = "Erik Belsom",Account_Manager__c = "Darin Fulks", Account_Manager__c =  "Joe Reynolds", Account_Manager__c = "Kevin Degel", Account_Manager__c =  "Mike Reichenbach", Account_Manager__c = "Shawn Mayfield", Account_Manager__c = "Ted Drysdale",Account_Manager__c = "Shannon Couch"), "Central",
IF(OR(Account_Manager__c= "Bill Lacaillade", Account_Manager__c = "David Pennington", Account_Manager__c = "Dominick Provisiero", Account_Manager__c = "Howard Johnson", Account_Manager__c = "Jacques Shelton", Account_Manager__c = "Kevin Boucher", Account_Manager__c = "Mark Brown", Account_Manager__c = "Joe Reynolds", Account_Manager__c = "Stacey Petyak", Account_Manager__c = "Tom Bracy", Account_Manager__c = "Travis Cronk", Account_Manager__c = "Nicholas Gorsky") "East",
IF(OR(Account_Manager__c = "Frank Harden", Account_Manager__c = "Jennifer Johnson", Account_Manager__c = "Mary Bateman", Account_Manager__c = "Rick Beaman", Account_Manager__c = "Tim Boyle",), "West", null)))

Jeff MayJeff May
You are missing a comma before the "East". You also have an extra comma after "Tim Boyle" before the paren. Then, you'll be golden
JaxBeachJaxBeach

Thanks, the formula worked great but now I get the following error message

 

Error: Compiled formula is too big to execute (6,916 characters). Maximum size is 5,000 characters

 

Looks like I can't win on this one :-)

Jeff MayJeff May

This one is tricky since you can't even break it apart into separate fields (cuz SFDC will re-assemble them for compilation). 

 

You can try using CASE(Account_Manager__c, "NAme1", "West", "Name2", "West","Name3", "East", null) and see if it compiles under 5000

 

Failing that, you might try CONTAINS(Account_Manager__c,"me1") and see how big that compiles (note that this one is risky since you are only checking a substring which can have interesting side effects if 2 names have the same string.