You need to sign in to do that
Don't have an account?
Hari nadh babu Eluru
Pincode must be exactly 6 digits
In this trigger apex, we can give Pincode__c text field. Pincode must be only 6 digits. If Pincode is exceeded 6 digits then we can show error message as "Pincode must be 6 digits"
I tried above code but not getting output:-
I tried above code but not getting output:-
trigger Exact_Six_Digits on Customer__c (before insert) { for(Customer__c u : trigger.new){ if(u.Pincode__c.length()!=6){ u.Pincode__c.adderror('Pincode must be 6 digits'); } } }Please give me suggestions for how to implement the condition. Thank you !
I don't see any issue with the code. Can you refresh the page and try to create a new record and check it.
Thanks,
All Answers
What type of field is pincode?
Thanks,
I don't see any issue with the code. Can you refresh the page and try to create a new record and check it.
Thanks,
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
you can try this