+ Start a Discussion
Geetanjali Sharma 9Geetanjali Sharma 9 

reset password functionality in BOT commands utility bar

Hi I have integrated BOT commands utility bar in my app. where we have list of bot commands like add two numbers, find contact, find opportunity. Now i want to add 1 more command by which if i give reset password it just reset the passowrd of loginned user. below is code..i beleive who used bOT command in app can understand it..please help where is am wrong..i am learner
**************************************************************************************
public with sharing class HandlerResetUserP implements BotHandler {
   
     public BotResponse handle(String utterance, String[] params, Map<String, String> session) {
        String key = '%' + params[0] + '%';
        List<User> users =
            [SELECT Id, name, alias FROM user where  Id = : UserInfo.getUserId()
             ORDER BY Name
             LIMIT 5];
       
        List<BotRecord> records = new List<BotRecord>();
       
        for (user u : users) {
           
           
           // List<System.ResetPasswordResult> passwords = new //list<System.ResetPasswordResult>;
            system.resetPassword(u.ID,true);
           
          
        }
        return new BotResponse(new BotMessage('Bot', 'Here is a list of contacts matching "' + params[0] + '":'));
       
    }
   
}