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 

Restrict a Formula to exclude a record type

Hi,  I have a really long formula and I need it to NOT look at account record type names that contain "International"  How can I add that to the existing formula below?

 

IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState<>NULL && CONTAINS ("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY", ShippingState), "Commercial Central/West",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState<>NULL && CONTAINS ("ND:SD:MN:WI:MO", ShippingState), "Commercial North Central",
IF(ISPICKVAL(Channel__c, "Commercial") && ShippingState <>NULL && CONTAINS("TX,AR,LA,OK", ShippingState), "Commercial TALO",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("NE:KY:KS:MI:IA:IL:IN:OH", ShippingState), "Commercial Midwest",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("ME:CT:DE:FL:MD:MA:WV:NH:NJ:NY:PA:RI:VT:VA:DC", ShippingState), "Commercial East",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <> NULL && CONTAINS ("NC:SC", ShippingState), "Commercial NC/SC",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("TN:GA:AL:MS", ShippingState), "Commercial South East",
IF(ISPICKVAL(Channel__c, "Forensics") && ShippingState <>NULL && CONTAINS("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY:ND:SD:NE:KS:OK:TX:MN:IA:MO:AR:IL:WI:MI", ShippingState), "Forensics - West",

IF(ISPICKVAL(Channel__c, "Forensics") && ShippingState <> NULL && CONTAINS("LA:MS:TN:KY:IN:OH:AL:CT:DC:DE:FL:GA:ME:MA:MD:NH:NJ:NY:NC:PA:RI:SC:VT:VA:WV:PR", ShippingState), "Forensics - East",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY", ShippingState), "LE West",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("CT:DC:DE:FL:GA:ME:MA:MD:NH:NJ:NY:NC:PA:RI:SC:VT:VA:WV:PR", ShippingState), "LE East",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("AL:AR:IL:IN:IA:KS:KY:LA:MI:MN:MS:MO:NE:ND:OH:OK:SD:TN:TX:WI", ShippingState), "LE Central", NULL))))))))))))

 

 

THANKS!

Best Answer chosen by Admin (Salesforce Developers) 
Vinita_SFDCVinita_SFDC

Replace false with null:

 

IF(CONTAINS($RecordType.Name, "International"),

 

 

, null)

 

Also you did not put Not in the condition, you want to check if the record type name does not contain 'international'

 

So make it like:

 

 

IF(NOT(CONTAINS($RecordType.Name, "International")),

 

 

, null)

All Answers

Vinita_SFDCVinita_SFDC

Try this:

 

IF(NOT(CONTAINS(RecordType.DeveloperName , International)),
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState<>NULL && CONTAINS ("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY", ShippingState), "Commercial Central/West",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState<>NULL && CONTAINS ("ND:SD:MN:WI:MO", ShippingState), "Commercial North Central",
IF(ISPICKVAL(Channel__c, "Commercial") && ShippingState <>NULL && CONTAINS("TX,AR,LA,OK", ShippingState), "Commercial TALO",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("NE:KY:KS:MI:IA:IL:IN:OH", ShippingState), "Commercial Midwest",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("ME:CT:DE:FL:MD:MA:WV:NH:NJ:NY:PA:RI:VT:VA:DC", ShippingState), "Commercial East",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <> NULL && CONTAINS ("NC:SC", ShippingState), "Commercial NC/SC",
IF (ISPICKVAL(Channel__c , "Commercial") && ShippingState <>NULL && CONTAINS ("TN:GA:AL:MS", ShippingState), "Commercial South East",
IF(ISPICKVAL(Channel__c, "Forensics") && ShippingState <>NULL && CONTAINS("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY:ND:SD:NE:KS:OK:TX:MN:IA:MO:AR:IL:WI:MI", ShippingState), "Forensics - West",

IF(ISPICKVAL(Channel__c, "Forensics") && ShippingState <> NULL && CONTAINS("LA:MS:TN:KY:IN:OH:AL:CT:DC:DE:FL:GA:ME:MA:MD:NH:NJ:NY:NC:PA:RI:SC:VT:VA:WV:PR", ShippingState), "Forensics - East",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("AK:AZ:CA:CO:HI:ID:MT:NV:NM:OR:UT:WA:WY", ShippingState), "LE West",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("CT:DC:DE:FL:GA:ME:MA:MD:NH:NJ:NY:NC:PA:RI:SC:VT:VA:WV:PR", ShippingState), "LE East",
IF(OR (ISPICKVAL(Channel__c , "Domestic"),ISPICKVAL(Channel__c , "Government"))&& ShippingState <>NULL && CONTAINS ("AL:AR:IL:IN:IA:KS:KY:LA:MI:MN:MS:MO:NE:ND:OH:OK:SD:TN:TX:WI", ShippingState), "LE Central", NULL)))))))))))),
false)

JaxBeachJaxBeach

I added the first and last line

 

IF(CONTAINS($RecordType.Name, "International"),

 

 

, False)

 

but it came back with IF() - expected text, received Boolean

Vinita_SFDCVinita_SFDC

Replace false with null:

 

IF(CONTAINS($RecordType.Name, "International"),

 

 

, null)

 

Also you did not put Not in the condition, you want to check if the record type name does not contain 'international'

 

So make it like:

 

 

IF(NOT(CONTAINS($RecordType.Name, "International")),

 

 

, null)

This was selected as the best answer
JaxBeachJaxBeach

that worked - thanks :-)