Something like this?
Create a javaaction for checking the BSN. add the input parameter 'bsnnr'. copy and paste the folowing code between the "//user code" tags
// BEGIN USER CODE
int checksum = 0;
double bsnnrDouble = 0;
try
{
bsnnrDouble = Double.parseDouble(bsnnr);
}
catch (Exception e)
{
return false;
}
if(bsnnr.length() != 9)
{
return false;
}
else
{
for(int i = 0; i < 8; i++)
{
checksum += ( Integer.parseInt(Character.toString(bsnnr.charAt(i))) *(9-i));
}
checksum -= Integer.parseInt(Character.toString(bsnnr.charAt(8)));
if(checksum % 11 != 0)
{
return false;
}
}
return true;
// END USER CODE
Create a javaaction for checking the bankaccount. add the input parameter 'bankaccountnr'. copy and paste the folowing code between the "//user code" tags.
// BEGIN USER CODE
bankaccountnr = bankaccountnr.replaceAll( "[^\\d]", "" );
int aantal_tekens = bankaccountnr.length();
int som = 0;
for (int i = 1; i < 10; i++)
{
int getal = Integer.parseInt(Character.toString(bankaccountnr.charAt(i-1)));
som+=getal*(10-i);
}
if (som % 11 == 0 && aantal_tekens == 9)
{
return true;
}
else
{
return false;
}
// END USER CODE
To me this sounds like something you´d want to do through validation rules with a proper Regular expression
You can check this using a simple java action in the before commit which optionally shows a datavalidation message.The code would be almost the same in java.
It doesn't seem so difficult to build in a microflow either. Just make a loop.