-
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
Agentforce: The Next Salesforce AI Evolution
Businesses are always looking for technologies that might provide them a competitive edge in the fast-paced digital landscape, particularly when it comes to managing sales,…
The Benefits of Salesforce Sales Cloud for your Business | The Ultimate Guide
In today’s competitive business environment, customer satisfaction and retention are key factors in achieving success. This is where Salesforce Sales Cloud comes into play. It is a…
Explore How DemandBlue’s Revenue Cloud Offering Could Enhance Your Business Model
Does your business lack absolute transparency across your sales cycle, finance operations, and revenue channels? Maybe it’s time to improve your game. If you are…
Popular Salesforce Videos
Apex Design Patterns: The Singleton Pattern in Salesforce
The Singleton Pattern One Private variable of the class itself will hold the instance of the complete class so that we can access all the…
Reassign Leads using Lead Assignment Rule on Update/Upsert | Salesforce Tutorials | #SalesforceBolt
In this vlog, we will do some work around Assignment Rules. As you are aware Assignment Rule can be trigger on Insert actions. Either it…
Salesforce Pay Expectations $$$ US and UK
Do you agree or disagree with these numbers? How do you think Mason Frank could have surveyed differently? In this video, Brad discusses just how…
Popular Salesforce Infographics
The Benefits Of PDO Partnerships & Its Strategic Advantages
Salesforce Product Development Outsourcers (PDOs) are specialized partners in the Salesforce ecosystem that help organizations develop, build, and bring their applications to the Salesforce AppExchange.…
Salesforce - Key For Your Industry Solutions
Salesforce endlessly improves the productivity and performance of the company. To enhance the customer experience and generate more revenue many industries will be opting for…
Salesforce CPQ Services & Processes: InfoDrive Solutions
Simplify your CPQ processes with InfoDrive Solutions Salesforce CPQ services. Work flexibly from any location, on any device, enhancing productivity and increasing deal-closure chances for…