-
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

A Guide to Customizing Your Salesforce Data Classification Settings
Your Salesforce Org stores a lot of sensitive information — and to help you properly protect it, the platform introduced a built-in data classification tool…

What Is Vlocity in Salesforce? Key Features and Business Applications
Founded in 2014, Vlocity rapidly established itself as a pioneer in the "industry cloud" space, earning three consecutive Forbes Cloud 100 awards in 2017, 2018, and 2019.…

Best Salesforce Training Program In 2022
If you're seeking the best Salesforce training program to become a Salesforce developer in 2022, you've come to the correct place. Salesforce is a vast…
Popular Salesforce Videos
Salesforce Professional Services Helps Customers Get Value From Salesforce, Faster
Our experts have helped thousands of customers transform their businesses, operating models, and cultures, all backed by the full power of Salesforce. Watch this video…
Why flow with Salesforce Flow?
Earlier when you required a custom feature in your Salesforce installation to support your business process, the only available options were to create a brand…
Salesforce Admin Interview Questions And Answers For Freshers & Experienced
This Salesforce Admin Interview Questions and Answers video includes all the frequently asked Interview questions that give you an idea to crack your Salesforce Admin…
Popular Salesforce Infographics

5 Security Habits That Help Your Salesforce Admin Career
As Salesforce Admins, you drive results and deliver business value every day. You automate processes and make them more efficient. You can also learn more…

How to Build Leads with Salesforce
Salesforce is a force to reckon with when it comes to inbound lead management. However, for certain businesses, especially smaller ones, the various add-ons and…

Salesforce Admin Certification Path
The Salesforce Certified Administrator program is designed for individuals who have experience as a Salesforce administrator. The program encompasses the breadth of applications, the features…