Skip to main content

Posts

Handling Encrypted Fields in Salesforce LWC: Displaying SSN Based on User Permissions

Use Case In Salesforce, encrypted fields provide an extra layer of security by allowing access only to users with the View Encrypted Data permission. In standard layouts and Lightning pages, Salesforce automatically manages the visibility of encrypted data based on a user's profile and permissions. However, if you're building a Lightning Web Component (LWC) that displays Social Security Numbers (SSN), you must manually handle data masking. The goal is: ✅ If a user has View Encrypted Data permission, they should see the full SSN (e.g., 113-212-4444 ). ❌ If a user does not have View Encrypted Data permission, they should see only the last 4 digits, with the rest masked (e.g., ***-***-4444 ). Since LWC does not inherently handle encrypted field visibility, we need to manage this logic in Apex before sending the formatted SSN to the component. Solution: Handling Encrypted SSN in Apex The best way to handle this is to: Check if the user has View Encrypted Data permission. Format the...
Recent posts

Quickly Creating Cases from the Salesforce Service Console Using Utility Actions.

Call center agents often face the challenge of efficiently capturing information while on a call, especially when they need to quickly create a case for a customer. To streamline this process, I developed a Lightning Web Component (LWC) that is launched as a utility action within the Salesforce Service Console. This solution enables agents to efficiently handle customer inquiries without losing context or valuable time. Use Case In a typical scenario: Dual-Monitor Setup: Call center agents often use two monitors—one for the primary console application and another for utility tools. Customer Interaction: While on a call, an agent may need to search for a customer's contact record using personally identifiable information (PII) like Social Security Number (SSN), Date of Birth (DOB), or Name. System Performance Delays: Contact records may take time to load due to backend processes or system latency. In the meantime, the agent still needs a place to capture customer details and ca...