-
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
Tips and Tricks To Pass The Test To Become a Salesforce Certified Administrator
Are you preparing to become a Salesforce Certified Administrator? If that’s the case, the exam might make you anxious and take you back to school,…
What is Sandbox and the Type of Sandbox in Salesforce?
A candidate who wants to come on the Salesforce program must know that the production environment of the development process is a necessary entity. That…
The Ultimate Guide to Setting Up a Salesforce Multi-language Platform for a Global Audience
Many businesses have thrived in the globalized market, especially small-medium enterprises. According to OECD, 95% of companies are SMEs, accounting for 60-70% of employment in…
Popular Salesforce Videos
Salesforce JavaScript Developer 1 Certification Series
Hi Everyone, SFDC Panther has started the Salesforce JavaScript Certification series and this is the first session. What you will learn: Variables Data Types Operators…
Salesforce Salaries In Current Market?
Wondering about the Salesforce salaries in the current market. Join this useful group for Salesforce job & career info and learn all about the Salesforce…
Salesforce CRM Services offered by Melonleaf Consulting
Melonleaf Consulting offers customized and configured Salesforce CRM Solutions and Services that can revolutionize your business. Experience the power of top-notch and highly effective Salesforce…
Popular Salesforce Infographics
4 Reasons To Offer An Exceptional Customer Service
When it comes to customer service, our friends at Salesforce have a few tips and tricks up their sleeve. We were thrilled to help them…
Features of Salesforce Spring’ 23 Release That Must Not Miss
The new updates in the Salesforce ecosystem will bolster the marketing power of the businesses. Companies are now more effectively building their marketing strategies which…
How Salesforce Admins Manage their Data?
No matter how long you’ve been working within Salesforce, it’s important to regularly evaluate the data management systems you have in place and review the…