-
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
Avoiding Race Conditions
An action function provides a way to submit a form programmatically via a JavaScript function call. When an action function is executed from a JavaScript event…
Salesforce Career Path - A Complete Guide
Salesforce is "the world's #1 customer relationship management (CRM) platform," according to the website of the production firm. Their software aims to assist businesses in…
Transformed And Accelerated Sales Cycles: How a Field Sales Management Solution Can Drive Success
In today’s highly competitive business landscape, organizations strive to gain a competitive edge and drive sustainable growth. One crucial element that can significantly impact a…
Popular Salesforce Videos
How To Create Workflow Rules In Salesforce | Salesforce Workflow Rules
This video walks through the steps to create a Workflow Rule within the Process Automation section of Lightning Settings in Salesforce. Get answers to the…
Salesforce for Beginners | Getting Started with Salesforce and CRM
Chapter 1 of Salesforce for Beginner. It includes the following topics: 00:11 Login and Navigation 00:31 App launcher 00:48 Search 01:15 List Views 02:23 Salesforce…
Get Started with Admissions Connect | Salesforce Tutorial
Ready to simplify the application process and streamline the work of your admissions professionals? Enter: Admissions Connect! This is the purpose-built product built natively on…
Popular Salesforce Infographics
Timing is Everything : Understanding B2B Buyer Behavior
B2B buyer activity and research peaks at different times of the year, week, and day. Software Advice conducted a study gathering data from six million…
Benefits of Using WhatsApp For Better Customer Engagement
WhatsApp makes businesses more interactive and reliable. Customers can directly connect with a company, clear their doubts, and leverage a connected experience. 5 million business…
Salesforce : Anatomy of a Productive Sales Rep
We are a nation obsessed with productivity. We look for ways to "hack" our way through life, squeezing the most out of every minute we…