-
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
Introduction To Salesforce Lightning Migration – Part 1
Technology has taken app development to a new level, making it more accessible than ever. One such technology, best known for its ability to empower…
Hire Salesforce Developers: Tips, Insights, and Why Folio3 is the Best Choice
In today’s fast-paced digital world, companies need reliable and scalable solutions for managing customer relationships, automating workflows, and enhancing user experience. Salesforce, a leading Customer…
Why ISVs Must Strive Harder To Be On AppExchange?
Are you on Salesforce AppExchange? How many apps do you have on Salesforce AppExchange? If you are an ISV then you must be pretty aware…
Popular Salesforce Videos
Salesforce Surveys | Salesforce Tutorial Video
In this short video, we will demonstrate how to enable surveys to use for employees. You can also enable surveys for customers or external participants…
Man Free Climbs 1,070-foot Salesforce Tower in San Francisco
A man free climbed San Francisco's Salesforce Tower Tuesday morning in response to the leaked draft in the Supreme Court Roe v. Wade abortion case.…
Use Salesforce Notification Builder to Get Notifications to the Right Users in the Right Apps
Did you know you can use Notification Builder to create custom notifications for teams, task queues, and public groups? You can also replace standard notifications…
Popular Salesforce Infographics
Salesforce Engage : Best Practices Guide for Sales Users
Salesforce Engage is a new solution from Salesforce Pardot that unites Sales and Marketing teams to sell more effectively than ever before. With Salesforce Engage,…
Unlock Efficiency & Growth: Key Salesforce Managed Services Benefits
Techforce Services is a leading Salesforce consulting and implementation partner, helping businesses across industries harness the full power of Salesforce. With certified experts and a…
The 6 Greatest Benefits of CRM Platforms | Salesforce CRM
A CRM platform helps companies target different audiences, set scores and alerts based on an individual lead or customer’s activity, proactively work with contacts and…