-
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 Management in Salesforce - Here is All You Need to Know
This is the important part to understand clearly as an administrator. In this blog we are going to learn about how the data is imported…
Flosum Tool - Release Management & Continuous Integration for Salesforce
Salesforce is a fantastic platform for building applications. Salesforce lacks enterprise release management tools to help developers collaborate across the entire process of application lifecycle…
Your Complete Guide to Salesforce Pardot
Pardot is a marketing automation platform similar to Marketing Cloud except it’s designed specifically for B2B contexts. It’s built with ease of use in mind,…
Popular Salesforce Videos
Salesforce Administrator Preparation - ADM 201
Salesforce Administrator Certification exam does not require any specific pre-requisites. But any working knowledge as an administrator or a developer or a functional consultant will…
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 Winter '23 Release Highlights - Video
Cosy up by the fireplace with a nice blanket and a cup of hot cocoa; Salesforce's Winter '23 update is as cool as ice! With…
Popular Salesforce Infographics
Salesforce Solutions For Travel Agencies
Salesforce for Travel is more than just a CRM. It’s a comprehensive ecosystem designed to empower travel agencies of all sizes. Comprehensive solutions offered by…
Top 5 Salesforce apps for sales and marketing managers
The sales rep, marketing professionals can effectively manage on the customer inquiries from different geographical areas through Salesforce CRM. Here I’m offering a roundup of…
Why Do Business Move To Salesforce?
Salesforce Improves Customer Data Quality & Management – One of the core functions of all CRMs is data management about customers. Salesforce delivers in this…