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…
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…
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…
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…
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…
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…
This article covers how to refresh data in a lightning web component with refreshApex. If you are looking for a how-to on refreshing the entire page or tab from a lightning web component, check out this post. In this simple example, the component contains a refresh button and information about a contact. We get the contact information in a wire function. If the contact updates, the cached data becomes stale. Import the refreshApex method and…
Help text in Salesforce is obviously readily available in the UI, but not so much when putting together reports. You may also want to see an overview across different objects for evaluating a system clean up & ensuring help text exists and is up to date. Here’s how you can export it by running a simple APEX script. Using Schema.SObjectField Let’s start with fields on a single object (further down we discuss exporting help text…
Scenario The accounting department wants to send automatic reminders for due & overdue invoices. They want to send these on the due date, as well as one & three business days after the due date. In this example, every invoice record has a due date field (Due_Date__c) and a status picklist field (Status__c) with the values Draft, Invoiced & Paid. Solution You set up a process builder flow that fires when the invoice status switches…
I generally use custom settings & labels to avoid hardcoding values, strings, etc. in APEX. Here’s how you can pass them to a Lightning web component. Let’s assume I want to use a custom setting called My_Custom_Setting__c with 2 fields (Field1__c, Field2__c) and 3 custom labels (labelName1, labelName2, labelName3). This is what the APEX class could look like: Custom settings are pretty straight forward: return the setting you need in an aura enabled method. For…