-
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 Spring'24 Release Notes Are Here: What’s New
The release notes for Salesforce Spring24 release notes are available here. The anticipated Spring24 release enables teams to work smarter by offering new product enhancements…
Enhancing Salesforce Development with SFDX: Key Strategies and Techniques
In the landscape of Salesforce development, Salesforce DX (SFDX) is a game-changer. More than just a tool, SFDX revolutionizes how developers create, test, and deploy…
5 Best Sales Cadence Tools for Automating Your Outreach
Today, sales tools are more than simply "nice-to-haves". They assist sales representatives by automating routine processes and increasing overall sales effectiveness to free up time…
Popular Salesforce Videos
How To Set Up DKIM Key In Salesforce?
If you use Salesforce for sending emails, we highly recommend setting up DKIM authentication to sign your outgoing messages and improve their deliverability and trustworthiness.…
Why Should You Attend Dreamforce To You 2020
Dreamforce - The event which brings together the entire Salesforce community is just around the corner. Learn why there’s so much hype around this mega…
Introduction to Flow in Salesforce
This informative video on flows in Salesforce contains the following topics:- 00:00 - Introduction 02:14 - Agenda 02:49 - Flow is Automation 03:35 - The…
Popular Salesforce Infographics
A Day in the Life Infographic: Best Practices Guide for Sales Users
The internet is full of sales best practices. But what most people forget is that, as a business, you need to come to the understanding…
What are Salesforce Lightning Web Components?
Lightning Web Components ( LWCs ) are User Interface (UI) framework and utilized for creating applications with desktop and mobile technologies. This framework acts as…
How to Choose the Right Salesforce Partner
Choosing the right partner is a key factor that could make or break your project’s success. Salesforce is a mighty CRM platform, and that’s why…