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
JC5JC5 

Syntax Error on Formula in Text Field

I created a custom text field called "Contract ID Number" and I want to only enter numbers. I was trying to use this formula
OR(LEN(Contract ID Number) <> 20)

But I get Error: Syntax error. Missing ')' I checked and I seem to close everything out properly. I'm pretty new to salesforce so any help would be much appreciated.

*Note: I could have used a number field, but I didn't because of the comma it generate (ex show 2000 instead of 2,000)
Best Answer chosen by JC5
ravi soniravi soni
hi JCS,
I think you should use Api Name Insted of Label.
E.g - OR(LEN(Contract_ID_Number__c) <> 20)
I am sure It will not generate any error.
let me know if it helps you and marking it as best.
Thank you

All Answers

VinayVinay (Salesforce Developers) 
You can create number 'Contract ID Number' field and use TEXT(Contract ID Number) in formula field.

Thanks,
CharuDuttCharuDutt
Hii JCS
Try The Following Validation Rule
IF( OR(LEN( FieldName) < 20,NOT(REGEX( FieldName, "^[0-9]*"))) ,true, false)
Please Mark It As Best Answer If It Helps
Thank You!

 
ravi soniravi soni
hi JCS,
I think you should use Api Name Insted of Label.
E.g - OR(LEN(Contract_ID_Number__c) <> 20)
I am sure It will not generate any error.
let me know if it helps you and marking it as best.
Thank you
This was selected as the best answer
JC5JC5
Thank you Veer Soni! Appreciate your help.