Generate Random String
DateTime currentDate = DateTime.now();
String randstring = currentDate.format('ddMMHHmmss');
Integer randomNumberToAppend = null;
while(true){
randomNumberToAppend = Integer.valueOf(Math.random()*10000);
if(String.valueOf(randomNumberToAppend).length()==4){
break;
}
}
randstring += randomNumberToAppend;
System.debug('randstring@@@'+randstring);
Comments
Post a Comment