Skip to content

Instantly share code, notes, and snippets.

@bdunagan
Created December 25, 2016 17:13
Show Gist options
  • Save bdunagan/36f1b2fbb68c553198316ba3149f8e78 to your computer and use it in GitHub Desktop.
Save bdunagan/36f1b2fbb68c553198316ba3149f8e78 to your computer and use it in GitHub Desktop.
Salesforce: How to Set Up Sales Territories with a Read-Only Custom Formula
# Salesforce Custom Formula for Worldwide Sales Territories
IF(ISBLANK(Country),"North America",
IF(CONTAINS("US:CA:PR",Country),"North America",
IF(CONTAINS("DE:AT:CH",Country),"DACH",
IF(CONTAINS("FR:MC:NC:PF:GP:RE:MQ:GY",Country),"France",
IF(CONTAINS("ES",Country),"Spain",
IF(CONTAINS("PT",Country),"Portugal",
IF(CONTAINS("IT",Country),"Italy",
IF(CONTAINS("AG:AI:AN:AR:AW:BB:BM:BO:BR:BS:BZ:CL:CO:CR:CU:DM:DO:EC:FK:GD:GL:GT:GY:HN:HT:JM:KN:KY:LC:MS:MX:NI:PA:PE:PM:PY:SR:SV:TC:TT:UY:VC:VE:VG:VI",Country),"Latam",
IF(CONTAINS("AS:AU:CK:CN:CX:FJ:FM:GU:HK:ID:JP:KH:KI:KP:KR:LA:MH:MM:MN:MO:MP:MY:NF:NR:NU:NZ:PG:PH:PN:PW:SB:SG:TH:TK:TO:TV:TW:VN:VU:WF:WS",Country),"APAC",
IF(CONTAINS("AD:AE:AF:AL:AM:AO:AZ:BA:BD:BE:BF:BG:BH:BI:BJ:BN:BT:BW:BY:CC:CF:CG:CI:CM:CV:CY:CZ:DJ:DK:DZ:EE:EG:EH:ER:ET:FI:FO:GA:GB:GE:GH:GI:GM:GN:GQ:GR:GW:HR:HU:IE:IL:IQ:IR:IS:JO:KE:KG:KM:KW:KZ:LB:LI:LK:LR:LS:LT:LU:LV:LY:MA:MC:MD:MG:MK:ML:MR:MT:MU:MW:MZ:NA:NC:NE:NG:NL:NO:NP:OM:PF:PK:PL:QA:RE:RO:RU:RW:SA:SC:SD:SE:SI:SJ:SK:SL:SM:SN:SO:ST:SY:SZ:TD:TG:TJ:TM:TN:TR:TZ:UA:UG:UZ:VA:YE:YT:ZA:ZM:ZR:ZW",Country),"Emea",
"-"
))))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment