Skip to main content

Apex & Dev

Explore practical guides and implementation patterns for this topic.

Posts

Salesforce Platform & Administration

Salesforce Basics: Custom Permission in Salesforce

💬 In plain words: A Custom Permission is a simple yes/no flag you attach to users, which your code and flows can check — like a feature switch per person. Use it instead of hardcoding profile names in logic. 📌 Example: Validation rule blocks editing closed Cases — but the audit team must edit them. Create Custom Permission Edit_Closed_Cases , add NOT($Permission.Edit_Closed_Cases) to the rule, and assign it to auditors via a permission set. No profile checks in formulas! 🎬 Real-Life Example: Bypassing a Validation Rule Imagine you have a rule: no one can discount an Opportunity by more than 20%. But the VP of Sales needs to override this rule when closing major deals. The Old/Bad Way (hardcoding): Write a validation rule checking profile names: Discount__c > 0.20 && $Profile.Name != 'System Administrator' && $Profile.Name != 'VP of Sales' . Why this is bad: If Regional Manager...
Read article
Salesforce Security & Access

Salesforce Basics: Manual & Apex Managed Sharing (the Share Object)

💬 In plain words: Every object has a hidden __Share table — each row is one key handed to one user/group with a reason. Manual sharing writes that row by hand. Apex managed sharing writes it in code when your logic decides who should see what. 📌 Example: On one confidential deal, the owner clicks Share and adds legal counsel. That's one row in OpportunityShare with RowCause = Manual . Your "reviewer field" automation writing the same kind of row from a trigger is Apex managed sharing. 🎬 Real-Life Example: The Backup Buddy Who Could Not See the Parcel Every Delivery has a backup driver, picked at runtime from a lookup. OWD on Delivery__c is Private. The backup must read the record. Nothing in roles or sharing rules can know who that person is in advance. The Old/Bad Way: Give drivers View All on Delivery__c , or open OWD to Public Read. Now every driver sees every parcel — payment details, home addresses, a...
Read article