How to solve LeetCode problem

LeetCode #28 Find the Index of the First Occurrence in a String

Javascript – LeetCode problem #28 Find the Index of the First Occurrence in a String In this problem, we need to create a method that detects if a given string (needle) occurs in another string (haystack) and return the index. Read the problem on LeetCode. Going letter by letter? It’s pretty obvious that we need some form of loop to compare both strings with each other. One option would be to evaluate letter by letter.…

How to solve LeetCode problem

How to solve LeetCode problem #9 Palindrome

Javascript – Leetcode problem #9 Palindrome In this problem, we need to create a message that evaluates if a given integer is a palindrome (reads the same way from left>right and right>left) and return true or false. Read the full problem on LeetCode. Pattern – How to detect a palindrome A palindrome is a string that reads the same from left to right or right to left, i.e. “Otto”, “121”. To detect whether a given…

How to solve LeetCode problem

How to solve LeetCode problem #12 Integer to Roman

Javascript – LeetCode problem #12 Integer to Roman In this problem, we need to create a method that translates an Integer (1<=n<=3999) to a Roman numeral. Read the full problem on LeetCode. Pattern – Deconstruct the Integer The key to solving this problem is understanding the construction pattern of Roman numerals: In summary, we need to look at each digit of the Integer and its “weigth” (thousands, hundres, etc.), then determine the correct Roman numeral…

How to solve LeetCode problem

How to solve LeetCode problem #13: Roman to Integer

Javascript – LeetCode problem #13 Roman to Integer In this problem, we need to create a method for converting Roman numerals into Integers (i.e. MMXXIV => 2024; III => 3; IX => 9; …). Read the full problem here. Pattern – Deconstruct the Roman numeral The key to solving this problem is understanding the construction pattern of Roman numerals: In summary, we need to look at each letter of the Roman numeral and compare it…

emailSimple action fails flow

Avoid deliverability errors in Salesforce Flow send email action

There are two ways to send emails from a flow in Salesforce: email alerts and send email actions. I’ve used email alerts a bunch without issue, but recently shifted to the send email action. Features like more customization and the ability to log those emails in the object activity feed make it pretty attractive. However, I ran into an issue where the send email action in Salesforce Flow (emailSimple) will fail if email deliverability is…

emp Api subscribe method

Emp API use case – track asynchronous operations

The Emp API module enables lightning web components to listen to event messages. This blog post covers a use case where event message streaming is used to track the status of an asynchronous operation. Scenario: An account creation trigger is getting and attaching files to the new account. This runs in a future method. Depending on how long this asynchronous method takes to complete, a user has to repeatedly refresh the account page before they…

alternative case accept buttons Salesforce

How to create extended functionality case accept quick actions

The standard Accept button for case list views and individual records changes the case ownership to the user who pressed the button. But what if you want to run additional actions like changing the case status? This blog post covers creating alternative accept buttons that can achieve this. One for the case list view (mass accept) and one for the case record page (single accept). Case List View – Mass Accept First, create an apex…

Article Search

How to show Classic knowledge articles in Salesforce Lightning

When migrating from Salesforce Classic to Salesforce Lightning, it’s also recommended to activate Lightning Knowledge. Classic knowledge articles are technically still available to users in Lightning. But, it’s more difficult to surface them in Lightning apps and pages. There are many benefits to activating Lightning Knowledge. However, depending on your structure and dependencies, migration could take some time. This article shows a work around. Use a Lightning web component to bring classic knowledge article search…

lwc copy text to clipboard

How to Copy to Clipboard in Lightning web component

Do you want to give users the ability to copy text to the clipboard from a Lightning web component? Here’s how you can do that. In this simple example, the Lightning web component contains both a link & lightning button icon that will copy text when clicked. Here, I’ve put the text I want to copy in the name attribute of the “a” and “lightning-button-icon” tags. This could also be a variable. The handleCopyText method…

simple-salesforce bulk logging

How to create meaningful log files for simple-salesforce bulk methods (Salesforce x Python)

This article discusses how to create meaningful error logs from simple-salesforce bulk methods. In this example, the python script is connecting to Salesforce querying all opportunities setting the ‘Description’ field on all opps to ‘Testing’ bulk upserting the opportunities Bulk data load job result logs This creates a bulk data load job in Salesforce. You can view it in Setup > Environments > Jobs > Bulk Data Load Jobs, including the logs. However, there are…