-
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
How to Call the Apex Method Imperatively in Lightning Web Component?
When we want to control when a method should be invoked (for instance, in response to a button click), we use an imperative method call. …
Top Salesforce Lightning Components to Improve Functionality
In this techie environment, it is the necessity to be with the new generation and meet up the expectation of the business organization. Almost every…
What is AI and Machine Learning?
Hey gyus how are yuo? I think you all are able to read the above line. Few words are incorrect but still you able to…
Popular Salesforce Videos
Salesforce Work.com Overview Demo Video
Salesforce Work.com provides you with essential solutions designed to help businesses reopen the workplace as quickly as possible, while keeping employees, customers, partners, and communities…
Opportunity Manager for Salesforce
Opportunity Manager for Salesforce - The first opportunity manager app that has taken the initiative of converting information and data in the form of user-friendly…
New Product: RepBlaze on Salesforce AppExchange
Visit on AppExchange: Click Here As a Sales manager, if you deal with 1000’s of inbound and other leads everyday and would love to automate…
Popular Salesforce Infographics
See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…
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…
Welcome to the Internet of Customers | Salesforce Infographic
You’ve heard this age-old adage a thousand times: “The customer is always right.” Today more than ever, the customer has countless technologies and practices in…