-
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 Non-Profit Organizations Can Make The Most Of Salesforce
Just like a business, nonprofits can also use Salesforce for streamlining workflows that benefit both internal and external stakeholders. Salesforce helps nonprofit organizations manage donation…
No Duplicates - Duplicate Management for Salesforce
No Duplicates is a brand new duplicate management app that is completely free. The app automates the entire deduplication process and provides reports for your…
Popular Salesforce Videos
Salesforce Lightning: Custom Theming and Branding
As part of myLightning, Custom Theming and Branding for Lightning Experience lets you customize key styling elements, such as the global header color, brand image,…
Salesforce Service Cloud Telephony
Natterbox CTI and Telephony inside Salesforce ServiceCloud. Transform your telephony experience and empower your agents with fast and personalised support.
Embracing the Future of Education Together | Leading Through Change | Salesforce
Learning should be equitable, safe, and connected from anywhere. The COVID-19 pandemic is straining our nation’s school systems and exacerbating inequity. Supporting students, families, educators,…
Popular Salesforce Infographics
How to Select A Cerified Salesforce Administrator?
Once you implement Salesforce, one of the most important ways to stay successful is to designate an incredible Salesforce Administrator. Easier said than done, right?…
Pardot January 2020 Release [Infographic]
HML Personalisation on Landing Pages and Forms What: HML is the new way to add personalization to Pardot marketing assets, replacing variable tags – you…
The Ultimate Marketing Automation Glossary
Sometimes, it sounds like marketers are speaking another language—especially when using terms associated with specific tools and platforms. It gets even more complicated when certain…