-
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
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')); } }
Log In to reply.
Popular Salesforce Blogs

Salesforce CPQ Basics Overview
Let's move on to know something about Salesforce CPQ which is a native Salesforce app that helps the sales teams to close their deals faster and…

Navigate your Career in Salesforce | Salesforce Guidance
How to start a career in Salesforce as a fresher or how to switch in Salesforce from any technology or domain? Salesforce is a Saas-based…
Popular Salesforce Videos
How to Create a Landing Page in Salesforce Account Engagement (Pardot)?
A landing page acts as a customized doorstep for potential clients. It's crucial because it guides their focus toward a particular action, such as signing…
Salesforce - How to Create and Debug Process Builders
Check out this video on how to debug Process Builders. Once you really get into building processes in Salesforce in can be confusing as to…
Salesforce Platform Quick Tip: How to Access Popular Items in a Single Click
Want to get to the things you use most with fewer clicks? Trailblazer and Senior Salesforce Developer, Ellie Matthewman shows us how to use favourites…
Popular Salesforce Infographics

How to Navigate a Successful Salesforce Implementation
There are many ways to navigate a Salesforce implementation. Check out this infographic to learn how to do it successfully.

Infographic: 3 Trends That’ll Transform Small Business Growth in 2018
If you’re hoping to successfully grow your small business this year, you need to stay on top of the newest trends. Not sure where to…

5 Advantages of Using Salesforce for Your Business
Salesforce is a customer relationship management (CRM) platform that offers a wide range of features and benefits for businesses of all sizes. Here are five…