Skip to content

Instantly share code, notes, and snippets.

@amitastreait
Created February 23, 2022 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitastreait/5d32ac9101d0660644a70abb124756c5 to your computer and use it in GitHub Desktop.
Save amitastreait/5d32ac9101d0660644a70abb124756c5 to your computer and use it in GitHub Desktop.
public class OTPGenerator {
@InvocableMethod(description='This method will be generating the OTP for users to Login'
label='Generate OTP'
category='OTP')
public static List<String> generateOtp(){
List<String> responseList = new List<String>();
String randomIntegerString = string.valueof(Math.abs(Crypto.getRandomInteger()));
String otp = randomIntegerString.substring(0,6);
responseList.add(otp);
return responseList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment