You need to sign in to do that
Don't have an account?
MUSFAR KT 6
I created field email and otp in Account object.whenever i create account using email field,at taht time otp will update account object
public class UpdateOTP{
public static void saveData(String email) {
List<Account> accsToUpdate = new List<Account>();
for ( Account a : [SELECT Id,OTP__c,Email__c from Account WHERE Email__c =:email]) {
if(a.OTP__c == null) {
Integer len = 5;
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
String pwd = key.substring(0,len);
System.debug('OTP**** '+pwd);
a.OTP__c = pwd;
}
accsToUpdate.add(a);
update accsToUpdate;
}
}
}
public static void saveData(String email) {
List<Account> accsToUpdate = new List<Account>();
for ( Account a : [SELECT Id,OTP__c,Email__c from Account WHERE Email__c =:email]) {
if(a.OTP__c == null) {
Integer len = 5;
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
String pwd = key.substring(0,len);
System.debug('OTP**** '+pwd);
a.OTP__c = pwd;
}
accsToUpdate.add(a);
update accsToUpdate;
}
}
}