Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Larz78

# New formula

Hello,

i am a newbie with SF and i am in desperate need to create a custom numeric field with inside a formula with the following validation rule:

1)take the first 9 number provided and multiply these numbers repectly with:6, 5, 7, 2, 3, 4, 5, 6, 7

for example if the 9 numbers are: 1,2,3,4,5,6,7,8,9 it is: (1*6) + (2*5) + (3*7) and so on....

2)Sum of the multiplications

3)Check of the last number provided (the 10th number) with the following: check digit = sum of the multiplications -  (218/11) * 11

Thanks a lot very much.

Swarnasankha

This could be done in the Validation Rule. Do you wnat the Validation to fire when the check digit is equal to the calculation or when it is not equal to the calculation? Also, could you give me a number combination which should pass as well as a one which should fail.

brunol11

Did you solve thiz maze?

I had the same problem here to generate billings code bar wich requires a validator digit.

there are two ways to solve it:

Up to 10 numbers, you can create a text field and map each digit with the functions TEXT, VALUE, MID and perform the rest with MOD and others operators,. For instance:

11-(MOD(((VALUE(MID(N__c,10,1))*2)+
(VALUE(MID(N__c,9,1))*3)+
(VALUE(MID(N__c,8,1))*4)+
(VALUE(MID(N__c,7,1))*5)+
(VALUE(MID(N__c,6,1))*6)+
(VALUE(MID(N__c,5,1))*7)+
(VALUE(MID(N__c,4,1))*8)+
(VALUE(MID(N__c,3,1))*9)+
(VALUE(MID(N__c,2,1))*2)+
(VALUE(MID(N__c,1,1))*3)),11))

If you have more then 10 digits to work with, you will need to run a workflow after a preliminary formula, caus there you can work with more than 5000 caracters. Choose to update the field with the formula. You probably will need 2 or 3 workflows to perform it. like 1 to validate if the mod is between 0 and 9 and other if the MOD is higher than that.

If you solved other way, let me know. Brazilians Bussiness are crazy for Validators Digits and every numbered document has to be calculated with at least one: CNPJ, CPF, Bar Codes, ID´s, Credit Cards, Debit  Cards... lol...

RAlbrecht

Olá, Brunol11

﻿

Voce tem um codigo para validar CNPJs e CPFs ?

Abs.,

Raphael

brunol11

Tenho as regras de validação de CNPJ prontas. Pra CPF é só ajustar.

manda um e-mail pra bruno.lube@live.com que te mando a validação. Não consegui postar aqui pois deu excesso de caracateres.

Marcos Rodrigues

Cara sabe alguma maneira de fazer mascara de campo (CPF/TELEFONE) sem utilizar visualforce?

Ricardo Mendonça
Pessoal, to precisando de Ajuda. Tenho um campo que preciso colocar a máscara do CNPJ validando. Podem me ajudar?
brunol11