-
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 Vaccine Cloud: Streamline Vaccine Management
Things are changing now - after one full year. COVID-19 cases have gone down, people are out again (with safety precautions though), and the new…
Stripe ACH Integration with Salesforce
During our previous conversation, we discussed how Stripe has changed the world of Online Payments in recent years. We also discussed that when we couple it…
Popular Salesforce Videos
Why Salesforce is in Demand? What is Salesforce? Salesforce Developer Jobs And Salary in 2022
In this video, Career Tips With Poonam discusses Salesforce job opportunities, what Salesforce is, Salesforce Developer Jobs and Salary in 2022 and much more.
What is Approval Process in Salesforce?
Automated process that approves records for the organization and it can be defined with a sequence of steps. Watch the video to learn and if…
How to Use Salesforce for Project Management
When you think of CRM software, "Salesforce" is probably one of the first words that comes to mind. But Salesforce can do so much more…
Popular Salesforce Infographics
What is Salesforce Architecture?
Have you ever wondered that what is so special about Salesforce? How does it manage to accomplish so much in such a less time? Well,…
Salesforce Data Migration: Best Practices to Ensure a Smooth Transition
Migrating data to Salesforce can be a daunting task, but it doesn't have to be. By following a few best practices, you can ensure a…
Best Practices For Cleaning and Maintaining Salesforce Data [Infographic]
Once you’ve had Salesforce up and running for a while, your system’s data will need to be tidied up. Or if you’re looking to move…