-
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
The Ultimate Guide To Making The Name Field Unique In Salesforce
The Salesforce platform has a unique function that allows users to create a custom page layout. This is a powerful tool since you are able…
Create a List View in Salesforce Lightning Experience
ListView allows you to see a filtered list of records, such as contacts, accounts, or custom objects. In list views, you can only see the…
Salesforce Consultant: 5 Things To Consider
Hire? Outsource? Contractors? Managed Services? Consultants? One thing that isn’t always top-of-mind when implementing a powerful CRM like Salesforce is the best strategy to keep…
Popular Salesforce Videos
Public Groups In Salesforce | Salesforce Development Tutorial
Public Groups In Salesforce. In this video, the following points will be covered - 1. Introduction Get a brief introduction about public groups. 2. Purpose…
Apex Performance Tips and Tricks | Salesforce Video Guide
Watch this video to learn all about Apex Performance: • What do we mean by performance? • How do we measure performance? • Loop Performance…
Salesforce CRM Full Training Tutorial For Beginners
In this video, Nick Boardman explains how to use the key features inside Salesforce CRM. He explains various dashboard options, setting up campaigns etc.
Popular Salesforce Infographics
Project Management Tools: Native on The Salesforce Platform
Finding the right solution that can help you use Salesforce for project management can be challenging. Integrating your project management with Salesforce helps you to…
Top 10 Salesforce Consulting Companies in India
Looking to hire a best Salesforce consulting company in India for your business? Here is a without-favour list of the top 10 Salesforce consulting companies…
Salesforce Marketing Cloud Features, Benfits and Advantages
Elevate Your Strategy: Discover the 4 Power Moves with Salesforce Marketing Cloud 1. ????????? ????????? Laser-focused campaigns for maximum impact. 2. ????-?????? ???????? Real-time analytics…