-
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

What is Enhanced Domain Security in Salesforce in 2023?
What is Enhanced Domain? Enhanced domains are the latest version of My Domain that meets the latest browser requirements. With enhanced domains, all URLs across your…

How to Send Email to Salesforce Sales Cloud Data from Marketing Cloud
This blog will tell you how one can fetch Salesforce data from the Sales cloud into the marketing cloud and then use the automation studio…

A Deep Dive Into Salesforce Winter '23 Analytics Updates
In this blog, we take a look at the new features and updates to Salesforce Analytics from the Winter '23 release. Custom Report Types As…
Popular Salesforce Videos
Salesforce Contact Tracing for Employees Demo
As businesses gradually reopen after worldwide closures, many people feel concerned about the second spike in COVID-19 cases. To ensure public safety, local officials have…
Salesforce Deployment Using Workbench | Salesforce Workbench Tutorial
Salesforce Deployment using Workbench. In this video, the following points will be covered - 1. Introduction Get a brief introduction about the Workbench tool. 2.…
How Customers Embrace Salesforce - Literally!
Get ready to giggle ???? Couldn’t get enough of the famous Key and Peele’s video doing the rounds on social media? Check out our version…
Popular Salesforce Infographics

Enable Ideas Management in Salesforce LEX to Drive Innovation
Leveraging and managing ideas on your Salesforce-powered communities can lead to business growth, improved product quality, and stellar customer experience. Not only does the Ideas…

Which Salesforce Certification is Right for You?
This informative infographic will help readers to decide which Salesforce certification is right choice for their Salesforce career.

Streamlining the Sales Process with Salesforce CPQ
Implementing Salesforce CPQ offers numerous business advantages, such as automating tasks, including sales quotations and price determination. Businesses that use Salesforce CPQ can expect increased…