Loading
Salesforce uitbreiden met klikken, en niet code
Voorbeeldvalidatieregels voor accountadressen

Voorbeeldvalidatieregels voor accountadressen

Regels om geldige accountadressen te behouden.

Vereiste editions

Beschikbaar in: zowel Salesforce Classic als Lightning Experience
Beschikbaar in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, Developer en Database.com Edition

Zie Operatoren en functies voor formules per context voor meer informatie over de formulefuncties die in deze voorbeelden zijn gebruikt.

Canadese factuurpostcode

Veld Waarde
Beschrijving: Valideert dat de account Factuurpostcode de correcte notatie heeft als Factuurland Canada is.
Formule:
AND(
OR(BillingCountry = "CAN", BillingCountry = "CA", BillingCountry = "Canada"),
NOT(REGEX(BillingPostalCode, "((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?"))
)
Foutbericht: Canadese postcodes moeten de notatie A9A 9A9 hebben.
Foutlocatie: Factuurpostcode

Factuurpostcode is in Factuurstaat

Veld Waarde
Beschrijving: Valideert dat de account Factuurpostcode geldig is door de eerste vijf tekens van de waarde op te zoeken in een aangepast object Postcode__c dat een record bevat voor elke geldige Amerikaanse postcode. Als de postcode niet voorkomt in het object Zip_Code__c of als de factuurstaat niet overeenkomt met het gerelateerde veld State_Code__c in het object Zip_Code__c, wordt er een foutbericht weergegeven.
Formule:
VLOOKUP(
$ObjectType.Zip_Code__c.Fields.City__c ,
$ObjectType.Zip_Code__c.Fields.Name ,
LEFT(BillingPostalCode,5)) <> BillingCity
Foutbericht: Factuurpostcode komt niet voor in de opgegeven staat van facturering.
Foutlocatie: Factuurpostcode

Factuurpostcode VS

Veld Waarde
Beschrijving: Valideert dat de account Factuurpostcode de notatie 99999 of 99999-9999 heeft als Factuurland USA of US is.
Formule:
AND(
OR(BillingCountry = "USA", BillingCountry = "US"),
NOT(REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?"))
)

In dit voorbeeld wordt de functie REGEX gebruikt. Zie Verzendpostcode als u niet vertrouwd bent met reguliere expressies.

Foutbericht: Postcode moet de indeling 99999 of 99999-9999 hebben.
Foutlocatie: Factuurpostcode

Verzendpostcode

Veld Waarde
Beschrijving: Valideert dat de Verzendpostcode van de account de indeling 99999 of 99999-9999 heeft, indien Verzendland USA of leeg is.
Formule:
AND(
 OR(ShippingCountry = "USA", ISBLANK(ShippingCountry)),
  OR(
   AND(LEN(ShippingPostalCode) <>5, 
      LEN(ShippingPostalCode) <> 10),
   NOT(CONTAINS("0123456789", 
      LEFT( ShippingPostalCode, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 2, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 3, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 4, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 5, 1))),
   AND(
    LEN(ShippingPostalCode) = 10,
   OR(
    MID( ShippingPostalCode , 6, 1) <> "-",
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 7, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 8, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 9, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 10, 1)))
   )
  )
 )
)

In dit voorbeeld wordt een leeg land geïnterpreteerd als de VS. Als u dit voorbeeld wilt gebruiken voor andere landen, verwijdert u de clause waarmee de lengte van het Land-veld wordt gecontroleerd. Verder is het zo dat validatieregelcriteria hoofdlettergevoelig zijn. Deze regel wordt dus alleen toegepast als het land leeg is of als er in hoofdletters "USA" staat. De regel wordt niet toegepast als het land "usa" is.

U kunt postcodes ook valideren met behulp van een reguliere expressie. Zie REGEX voor een voorbeeld van een formule met behulp van een reguliere expressie.

Foutbericht: Postcode moet de indeling 99999 of 99999-9999 hebben.
Foutlocatie: Verzendpostcode

Geldige factuurstaat (VS)

Veld Waarde
Beschrijving: Valideert dat de Factuurstaat/provincie van de account een geldige afkorting van twee tekens is, indien Factuurland US, USA of leeg is.
Formule:
AND (
OR(BillingCountry = "US", BillingCountry="USA", ISBLANK(BillingCountry)),
OR(
LEN(BillingState) < 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", BillingState)
)))

In dit voorbeeld wordt een leeg land geïnterpreteerd als de VS. Als u dit voorbeeld wilt gebruiken voor andere landen, verwijdert u de clause waarmee de lengte van het Land-veld wordt gecontroleerd. Verder is het zo dat validatieregelcriteria hoofdlettergevoelig zijn. Deze regel wordt dus alleen toegepast als het land leeg is of als er in hoofdletters "USA" staat. De regel wordt niet toegepast als het land "usa" is.

Foutbericht: Een geldige staatcode van twee letters is vereist.
Foutlocatie: Factuurstaat/provincie

Geldige factuurprovincie (Canada)

Veld Waarde
Beschrijving: Valideert dat de Factuurstaat/provincie van de account een geldige afkorting van twee tekens is, indien Factuurland CA of CAN is.
Formule:
AND (
   OR(BillingCountry = "CA", BillingCountry="CAN"),
   OR(
   LEN(BillingState) < 2,
   NOT(
      CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", BillingState)
)))
Foutbericht: Een geldige provinciecode van twee letters is vereist.
Foutlocatie: Factuurstaat/provincie

Geldige verzendstaat

Veld Waarde
Beschrijving: Valideert dat de Verzendstaat/provincie van de account een geldige afkorting van twee tekens is, indien Verzendland US, USA of leeg is.
Formule:
AND (
OR(ShippingCountry = "US", ShippingCountry="USA", ISBLANK(ShippingCountry)),
OR(
LEN(ShippingState) < 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", ShippingState)
)))

In dit voorbeeld wordt een leeg land geïnterpreteerd als de VS. Als u dit voorbeeld wilt gebruiken voor andere landen, verwijdert u de clause waarmee de lengte van het Land-veld wordt gecontroleerd. Verder is het zo dat validatieregelcriteria hoofdlettergevoelig zijn. Deze regel wordt dus alleen toegepast als het land leeg is of als er in hoofdletters "USA" staat. De regel wordt niet toegepast als het land "usa" is.

Foutbericht: Een geldige staatafkorting van twee letters is vereist.
Foutlocatie: Verzendstaat/provincie

Geldige verzendprovincie (Canada)

Veld Waarde
Beschrijving: Valideert dat de Verzendstaat/provincie van de account een geldige afkorting van twee tekens is, indien Factuurland CA of CAN is.
Formule:
AND (
OR(ShippingCountry = "CA", ShippingCountry="CAN"),
OR(
LEN(ShippingState) < 2,
NOT(
CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", ShippingState)
)))
Foutbericht: Een geldige provincieafkorting van twee letters is vereist.
Foutlocatie: Verzendstaat/provincie

Geldig factuurland

Veld Waarde
Beschrijving: Valideert dat het Factuurland van de account een geldige ISO 3166-code van twee letters is.
Formule:
OR(
LEN(BillingCountry) = 1,
NOT(
CONTAINS(
"AF:AX:AL:DZ:AS:AD:AO:AI:AQ:AG:AR:AM:" &
"AW:AU:AZ:BS:BH:BD:BB:BY:BE:BZ:BJ:BM:BT:BO:" &
"BA:BW:BV:BR:IO:BN:BG:BF:BI:KH:CM:CA:CV:KY:" &
"CF:TD:CL:CN:CX:CC:CO:KM:CG:CD:CK:CR:CI:HR:" &
"CU:CY:CZ:DK:DJ:DM:DO:EC:EG:SV:GQ:ER:EE:ET:FK:" &
"FO:FJ:FI:FR:GF:PF:TF:GA:GM:GE:DE:GH:GI:GR:GL:" &
"GD:GP:GU:GT:GG:GN:GW:GY:HT:HM:VA:HN:HK:HU:" &
"IS:IN:ID:IR:IQ:IE:IM:IL:IT:JM:JP:JE:JO:KZ:KE:KI:" &
"KP:KR:KW:KG:LA:LV:LB:LS:LR:LY:LI:LT:LU:MO:MK:" &
"MG:MW:MY:MV:ML:MT:MH:MQ:MR:MU:YT:MX:FM:MD:MC:" &
"MC:MN:ME:MS:MA:MZ:MM:MA:NR:NP:NL:AN:NC:NZ:NI:" &
"NE:NG:NU:NF:MP:NO:OM:PK:PW:PS:PA:PG:PY:PE:PH:" &
"PN:PL:PT:PR:QA:RE:RO:RU:RW:SH:KN:LC:PM:VC:WS:" &
"SM:ST:SA:SN:RS:SC:SL:SG:SK:SI:SB:SO:ZA:GS:ES:" &
"LK:SD:SR:SJ:SZ:SE:CH:SY:TW:TJ:TZ:TH:TL:TG:TK:" &
"TO:TT:TN:TR:TM:TC:TV:UG:UA:AE:GB:US:UM:UY:UZ:" &
"VU:VE:VN:VG:VI:WF:EH:YE:ZM:ZW",
BillingCountry)))
Foutbericht: Een geldige landcode van twee letters is vereist.
Foutlocatie: Factuurland
 
Wordt geladen
Salesforce Help | Article