-
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
Remarkable Ways To Grow Your Business With Sales Cloud
The end goal of every business is to maximize its sale because that is the only thing that creates revenue for it. Lead generation, improving…
What Is Salesforce? How Is It Used and How Does It Impact Business?
More than 80% of the Fortune 500 companies in the world use at least one Salesforce app. Such is the deep impact and penetrative power…
Why Manual Testing Is Quietly Killing Your Salesforce Releases
If you've ever pushed a Salesforce release on a Friday afternoon and spent the weekend refreshing your phone waiting for a bug report, you already…
Popular Salesforce Videos
Is the Salesforce Marketing Cloud the Future For Business?
As the market changes, one needs to keep up with the times. Companies are interested in Salesforce Marketing Cloud because it gives them a competitive…
What Is Salesforce Industries (Vlocity)?
Vlocity (Salesforce Industries) offers pre-built solutions on the Salesforce platform that solve the needs of particular industries that require CRMs to be heavily customized beyond…
When Salesforce is Down/Offline - Keep on Going With Zoho
Wtahc this video and learn how to keep your organization moving when Salesforce is DOWN or OFFLINE. Do let us know if you have any…
Popular Salesforce Infographics
The Working Of Salesforce CRM
Salesforce CRM is considered as the #1 CRM in the market. It has the ability to manage customer interactions of an organization through several methods.…
Salesforce Almanac
Salesforce is the number one CRM of the world and it has attained great popularity over the years. Its journey is worth seeing so here…
How to start your career In Salesforce?
Considering a career in Salesforce is a good choice for IT professionals looking to give a new boost to their career. Salesforce is a new…