-
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
All About Salesforce Marketing Cloud, Email studio and Content Builder
Hey you all, hope you are doing well! In this blog, I am going to tell you about Marketing Cloud and its primary email sending…
What’s New In Salesforce DX Open Beta?
Last year Dreamforce gave us another mind blowing way to manage and develop Salesforce apps in a lucid fashion throughout the entire app lifecycle. This…
What Are The Types of Custom Setting In Salesforce
In Salesforce, Custom settings are alike to custom objects. By reading this line we think about that, if both are similar then why do we…
Popular Salesforce Videos
Salesforce Chatter Tutorial | Chatter Overview And Demo | Chatter In Salesforce
This Salesforce Chatter Tutorial will give an overview of Chatter which includes enabling chatter, configuring chatter groups and creating customer groups. Salesforce Chatter will be…
Work With Custom Lightning Components | Salesforce Tutorial
Creating a custom Lightning component requires programming skills. Or, you can install an existing Lightning component from the AppExchange. You can create a custom Lightning…
Build a Discount Calculator | Trailhead - Autolaunched Flow Salesforce Example
In this video, I'm creating a Discount Calculator with the help of Salesforce Flow to Automate Your Business Processes with Lightning Flow. So it's a…
Popular Salesforce Infographics
Salesforce and QuickBooks Integration - Transform your Business
Do you know that you can convert 30% of your opportunities into leads when you integrate Salesforce and QuickBooks together? Sounds Interesting right? Our connector eShopSync…
DataArchiva - A Native Data Archiving App for Salesforce using Big Objects
A Native Data Archiving app for Salesforce using Big Objects. With Auto-scheduler, Custom Archiving, Encryption, Integrity and Restore features, DataArchiva saves 85%+ storage costs, improves…
How to Use Psychology to Target Your Buyer?
Ever wanted to get into the minds of your customers and figure out how they think? Ever wanted to know the best methods to convince…