-
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 Clone a Record In Apex?
What is Clone Record in Apex? The clone() method in Salesforce Apex makes a duplicate of the sObject record. There are four Boolean-type optional parameters…
Top Salesforce Integration Tools to Boost your Sales
When it comes to improving productivity and business relationships, the importance of Salesforce CRM solution remains undisputed. Salesforce system allows B2B and B2C businesses to…
Popular Salesforce Videos
Understanding Leads, Accounts, Contact, Opportunities, Products, Pricebooks objects in Sales Cloud
In this video, I have explained how Salesforce SalesCloud can boost your companies productivity. Some Important object of Sales Cloud : 1. Campaign 2. Lead…
Salesforce Financial Services Cloud demo
Today's seamlessly connected customer is raising expectations for organizations to "show them they know them" by providing efficient, informed and integrated experiences no matter which…
Salesforce Training Videos 1 for beginners with RealTime Projects Salesforce Demo
This video explains what a primary level person should be doing after getting any Salesforce Project. What should be steps for the same.
Popular Salesforce Infographics
Salesforce – The Future of Digital Transformation | An Infographic
Salesforce has been coined as the world’s top CRM company and customer company. It has been soaring high in the clouds, so let’s brush through…
How Customer Experience Is Rewriting the Rules of Business Success
Your guide to customer experience - Customers expectations are changing. And as they change, businesses face sky high standards for delivering customer experience that's a…
5 steps to follow for successful Salesforce Implementation
Although implementing Salesforce is designed to help you meet the challenges of your business, it might not provide the results you want, whether it is…