Activity Forums Salesforce® Discussions I want to generate a random string,which contain alphabet and number both,please help to write a code.

  • Himanshu

    Member
    August 16, 2016 at 8:20 am

    Hi Tanu,

    Use the below code:-

    Integer len = 6;
    Blob blobKey = crypto.generateAesKey(128);
    String key = EncodingUtil.convertToHex(blobKey);
    String pwd = key.substring(0,len);
    System.debug('************ '+pwd);

    Hope this helps you.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos