• #25699
    Salesforce | GEETANAJLI GEETANAJLI #178
    Forcetalks

    Implementing Reset password in BOT commands that is included in Utility BAR in Salesforce

    Hi Guys,

    I am new to Salesforce coding. I believe everybody knows abut BOT COMMANDS Utility bar. below is link

    https://developer.salesforce.com/blogs/developer-relations/2017/03/bot-toolkit-creating-deploying-bots-inside-salesforce.html

    So i have configured it in my salesforce app. Now i am trying to implement add on command reset password which will simply just reset the password of loginned user by sending reset user password email.  but my code is not working when i am including system.resetpassword(id, true). it is saving code but when i am passing parameter in BOt command nothing happening .please check my code and correct me where is am  wrong?

    public with sharing class HandlerResetUserP implements BotHandler {
    
    public BotResponse handle(String utterance, String[] params, Map<String, String> session) {
    // String key = '%' + params[0] + '%';
    // string result=' ';
    List<User> users =
    [SELECT Id, Username, name, aboutme, employeenumber,OHR_ID__c FROM user
    // WHERE name LIKE :key
    where Id = : UserInfo.getUserId()
    ORDER BY Name
    LIMIT 5];
    
    // List<BotRecord> records = new List<BotRecord>();
    
    for (user u : users) {
    //after disable resetpassword step, it is responding
    
    try
    {
    
    system.resetPassword(u.Id,true);
    
    return new BotResponse(new BotMessage('Bot', 'Reset done'));
    
    }
    catch(Exception e)
    {
    return new BotResponse(new BotMessage('Bot', 'some some error.'));
    }
    
    //system.debug('DONE: ' + u.Id);
    }
    
    return new BotResponse(new BotMessage('Bot', 'last line'));
    
    }
    }
    

    Tagged: , , , , ,

Viewing 1 post (of 1 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?