-
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

How to Become a Freelance Salesforce Consultant
Ask any freelancer out there what they love about freelancing. The first thing they tell you is the room to work flexibly, remotely, and how…

What are the Top 10 Useful Extensions In Salesforce in 2023?
The top 10 useful extensions for Salesforce in 2023 are: Salesforce Inspector Productivity tools for Salesforce administrators and developers to inspect data and metadata directly…

Why Should You Attend Salesforce Dreamforce 2019 & How To Make The Most Out Of It?
Dreamforce is a yearly conference that takes the full Salesforce people group composed. SF clients, workers, partners, and important partners gather in San Francisco over…
Popular Salesforce Videos
Tip Calculator in Lightning Component SalesForce ☁️
In this video, I will create a calculator in Lightning Component. It won't be an ordinary calculator, it will be a Tip calculator for Restaurants…
Reaching Potential Customers With Salesforce Marketing Cloud
Salesforce Marketing Cloud helps businesses in closely observing consumer behavior. Marketing Cloud has a number of platforms that are well-segregated and immensely useful in defining…
How to Create Opportunity Teams | Salesforce Tutorial
Want to give all the people who help out on your opportunities easy access to the opportunity record in Salesforce? Or maybe you've got an…
Popular Salesforce Infographics

Salesforce Jobs Market Couldn't Be Better!
Anyone that’s transitioned their career to Salesforce can agree: the market for Salesforce Jobs couldn’t be better. If you’re looking for some inspiration to make…

Your Guide to Salesforce Certifications
In the age of customer experience, businesses now rely on their CRM systems more than ever. As the world leader in CRM software, Salesforce knows…

Why Integrate Your Pardot Account with Salesforce?
Salesforce Sales Cloud is primarily a sales tool while Pardot is a marketing automation platform. Both are designed to increase sales and maximize efficiency for…