-
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
What Makes Teqfocus Your Perfect Salesforce Partner
When you ask yourself the question of which Salesforce company is the best in India and which company should you consider as the perfect Salesforce…
Automation of JSON2APEX - My journey to writing my own automated tooling for this!
Lyrics Each and every time developing an integration, I wanted to automate the most tedious and routine part of it - creating wrappers for integration…
7 Reasons to Choose Odoo ERP Over Other Open-Source ERP Platforms
ERP decisions rarely fail because of software features. They fail when businesses realize too late that the system does not match how their operations actually…
Popular Salesforce Videos
Salesforce For Beginners - Create Lookup , Master-Detail Relationship and Rollup Summary
Salesforce Administration tutorial which demonstrates how to create Lookup Relationship, Master-Detail Relationship and Rollups . Things to be learned from the video : How to…
How to Enable and Create the B2B Marketing Analytics App in Salesforce
This video will walk through the steps to enable Pardot B2B Marketing Analytics in Salesforce Setup, and the creation of the B2BMA app. Prerequisites and…
Salesforce Announces New Salesforce CDP Updates
Salesforce has recently announced a new series of innovations for its customer data platform (CDP). These Salesforce CDP updates have been developed to help companies…
Popular Salesforce Infographics
How Low-Code App Development Enables Business Agility in Times of Change | Salesforce
Businesses in today's fast-changing, the digital-first world must adapt to change and meet customer demands in innovative ways. They have to quickly digitize to make…
What are the Benefits of Salesforce CPQ Managed Services?
There are a few benefits of Salesforce CPQ Managed Services that can help organizations maximize their growth and profit margins. Prediction of cost - Salesforce…
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…