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
PAWAN THOSARPAWAN THOSAR 

create trigger on postal code must be 6 digit only custom object= State(picklist), postal code=?

Best Answer chosen by PAWAN THOSAR
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Pawan,

Can you try below validation rule.
 
OR(
ISBLANK( Postal_Code__c ),
Postal_Code__c > 999999,
Postal_Code__c <99999
)

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
HI Pawan,

You want to check only postalcode right? Can you provide the API name of custom object

Thanks
 
PAWAN THOSARPAWAN THOSAR
Postal_code__c
Sai PraveenSai Praveen (Salesforce Developers) 
hi,

It is field I guess. I need the custom object API name.

Thanks
 
PAWAN THOSARPAWAN THOSAR
State__C  (picklist)
Postal_code__c = i want to only 6 digit no
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Pawan,

Can you try below validation rule.
 
OR(
ISBLANK( Postal_Code__c ),
Postal_Code__c > 999999,
Postal_Code__c <99999
)

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
This was selected as the best answer
PAWAN THOSARPAWAN THOSAR
ty
PAWAN THOSARPAWAN THOSAR
this code is working