contactdetails = zoho.crm.getRecordById("Contacts",contactId);
contid = contactdetails.get("ID_Number");
// Replace with the actual field name
if(contid.length() == 13)
{
if(contid.substring(0,2).matches("\\d{2}") && contid.substring(2,4).matches("\\d{2}") && contid.substring(4,10).matches("\\d{6}") && contid.substring(10).matches("[\\dA-Z]{10}"))
{
result = "South African ID number";
}
else
{
result = "Invalid input";
}
}
else if(contid.length() == 9)
{
if(contid.substring(0,2).matches("[A-Z]{2}") && contid.substring(2).matches("\\d{7}"))
{
result = "South African Passport number";
}
else
{
result = "Invalid input";
}
}
else
{
result = "Invalid input";
}
info result;
Kindly advise why you think it is not working.
Regards