Posts

Types of relationship fields in Salesforce

How to get translations for custom labels

Check all checkbox while setting FLS from Profile

Open your Browser Press Ctrl + D to create a bookmark. Click on Edit. Enter Name as desired, eg: chkAll - ReadAll In the URL Enter the code below, and Click Save. To Check All Read-Only Checkbox javascript:(function(){var x = document.querySelectorAll(".readonlyCol input");for (var i = 0; i < x.length; i++) { x[i].checked=true;}})(); javascript:(function(){var x = document.querySelectorAll(".displayedCol input");for (var i = 0; i < x.length; i++) { x[i].checked=true;}})(); To UnCheck All Read-Only Checkbox javascript:(function(){var x = document.querySelectorAll(".readonlyCol input");for (var i = 0; i < x.length; i++) { x[i].checked=false;}})(); javascript:(function(){var x = document.querySelectorAll(".displayedCol input");for (var i = 0; i < x.length; i++) { x[i].checked=false;}})();

Inbound Email Handler In Salesforce

What is an Inbound Email handler ? Inbound Email Handler is an Email Service in Salesforce implemented using Apex and is an alternative to Email-To-Case. Why Inbound Email handler ? When we need to perform other operation after creating a Case or if we need to perform certain operation on a existing Case. For example creating a child Case record or updating an already existing Case with an attachment/reply. The Standard Email-To-Case is limited to Case where the Inbound Email Handler can be used with any Standard/Custom Objects. The statement above is also the difference between email to case and apex email service. Examples :-  global class ContactInboundEmailHandler implements Messaging.InboundEmailHandler { global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env){ Messaging.InboundEmailResult result = new Messaging.InboundEmailResult(); C...

Allow other users to unlock record in approval process

Lock() and unlock() methods in the System.Approval Class let you lock and unlock records by passing in record IDs or sObjects. Enable the feature by :- Setup --> Process Automation Settings --> Enable record locking and unlocking in Apex. Create a Detail Page Button and associate it with the Visualforce Page and place it on the Page Layout.  Create a Visualforce Page <apex:page standardController="Order" extensions="OrderLockUnlockController" action="{!unlock}"> </apex:page> Create a Class public class OrderLockUnlockController{ private Id recId; public OrderLockUnlockController(ApexPages.StandardController stdCtrl) { recId = stdCtrl.getId(); } public PageReference unlock(){ if (Approval.isLocked(recId)) { Approval.unlock(recId); } PageReference pageRef = new PageReference('/'+recId); pageRef.setRedirect(true); r...

How to delete or deactivate apex class / trigger in Salesforce Production

Unlike the Developer Edition and the Sandboxes where we can simply click on delete or uncheck "Is Active" and delete/deactivate the Apex Class/Trigger, production does not allow us to do so. How to delete or deactivate apex class/trigger in Production. 1. Using Eclipse Import the org in eclipse. Open the .xml file of the Class/Trigger Change "Status" Trigger: "Active" to "Inactive" Class: "Active" to "Deleted" Save the XML. 2. Deployment from sandbox Make changes(Eg: Comment the lines) in your sandbox and deply to Production.