Formula to Validate PAN and GST Number in Salesforce


 In this article we will create a formula to validate the GST and PAN Number. The requirement was to validate regex of PAN and GST number, both fields are mandatory and the GST number should contain PAN number.

Please check below formula and modify it as per your requirement.

1
2
3
4
5
6
7
IF(OR(
PAN_No__c == NULL, GST_No__c == NULL,
NOT( REGEX( PAN_No__c , "[A-Za-z]{5}[0-9]{4}[A-z]{1}") ),
NOT(REGEX(GST_No__c,"^([0][1-9]|[1-2][0-9]|[3][0-7])([a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9a-zA-Z]{1}[zZ]{1}[0-9a-zA-Z]{1})+$")), MID(GST_No__c,3,10) != PAN_No__c
)
,TRUE,FALSE
)


 If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks
Keep Coding 




Post a Comment

0 Comments