Validation rule for "-", automatic

Hi,

I have a requirement, system should perform the following validations for particular ID.

should be numeric, the user should not be able to enter text, should be 9 digits and should follow the following format: xxx-xx-xxxx. The dash should be automatically written by the system. There will be no access for special characters. So, please suggest me best solution to achieve.

Hi @Praveenn881

Hope this helps :

Thanks

@Praveenn881

You can use an edit validate rule. You can also create a DT/Activity where first you can check the validation of the user input against alphabets and special characters, then after the validation passes you can substring the input into 3 params and concatenate those with ‘-’ in between.

Hi @Praveenn881,

we achieve this by creating edit input rule in that rule add the below code.

if (theValue.length() > 3 && theValue.charAt(3)!=‘-’)

{ StringBuilder sb = new StringBuilder(theValue);

theValue=sb.insert(3, ‘-’).toString();

}

Thanks,

Sai G

Hi @Praveenn881

There is a similar post. You can visit this link https://support.pega.com/question/need-edit-validate-rule-xxx-xxxxx-format

thanks