-
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
Data Quality Analysis Dashboard App in Salesforce
As you all know about the importance of Data Integration in Salesforce, we should understand that before Data integration, Data Quality analysis and management are…
Maximizing Efficiency: Exploring Related Lists with PWR Components
Introduction Salesforce, renowned for its CRM capabilities, faces limitations in managing intricate business scenarios, particularly in e-commerce. Traditional Salesforce-related lists struggle with dynamic data and…
Learn All About Salesforce Apex Programming Language
What is Apex? In the CRM cloud platform, Apex is an object-oriented programming language that has syntax similar to Java, which is also an object-oriented…
Popular Salesforce Videos
Create and Format Derived Measures
In the explorer, you can perform calculations on existing measures and use the results to create a new measure that’s not part of your dataset.…
How to Get Experience Without the Job? | Salesforce Learning
Want to get experience without the job? Watch the full episode here: https://youtu.be/oG8sHOW8GI4 Shrey is a Chief Executive Officer at Cyntexa, a SILVER Salesforce Consulting…
How to Focus on Report Results in Salesforce Console | Salesforce
When you work with reports in a fast-paced Salesforce Console environment, every extra click or focus change can slow you down. Now a streamlined console…
Popular Salesforce Infographics
Customer Service Words and Acronyms
Savvy service reps know it is important to stay hip with the lingo. If it seems like customers and agents always keep you guessing with…
Explore The Salesforce Support Services Process Chart
This infographic helps you to explore the Salesforce Services process chart. Go through it and let me know in the comments in case of any…
The Demand for Salesforce: Salesforce Developer Salaries and Opportunities
Businesses today face unique growth challenges in an increasingly competitive digital space. The greatest challenge is to generate leads and convert them to loyal customers…