Skip to main content


Trick to Populate Email formula field in Email Alert in Salesforce

 As we know, formula field is not acceptable in Email Alert although the type is email . So there a hack to get away from it. I forgot where I read this info, credit to that developer. We have run some unit test and so far it works. The drawback ; you may get error during deployment so you need to do it manually. So it may cost in maintenance section if you need to change email alert. But if email alert is seldom change, it might be worth especially the email actually derived from the parent object. For example if the email field is at Account level but you need to create email alert at Opportunity. It's quite costly if you need create field update to populate Opportunity with Account email field while actually you can just read using formula from Opportunity. Here are the steps : 1) Create formula field at Opportunity ; data type is text (I forgot to check why I don't use email)  2) In the email alert , at Recipient select one user  3) Once select , right Click Inspect Element
Recent posts

Part 1 : Too many soql in Real Life

I have encountered a lot of question about Too Many SOQL limit in Salesforce before in different companies. Honestly I don't feel it is fun work however while working on them I gain a lot of knowledge depending on how I  plan to fix it and increase some confidence level because , hey you read trigger and code line by line, review any component such as Process Builder, Flow. Looking closely to any possible holes and  understand it and try to figure out the most effective way to deliver eat. So at last, I writing this entry as I got so many misunderstood about Too many soql limit. Some thought it is so complex and the rest of them thought it's so simple until it being treated as miscellanous. This is how we started... imagine that you travel to somewhere, maybe far away to the mountain with very great car that have spacious space (uhmm of course the car space have limit, spacious does not mean you can put everything inside. You need to put your item in your car. So you put maybe

Checking API for Salesforce Platform API Versions 7.0 through 20.0 Retirement using Workbench

 The guideline on Salesforce Platform API Versions 7.0 through 20.0 Retirement  can be referred here . In this entry, I would like to share how I check REST/SOAP log so that I can check the API version. Note : To view log file , you need a licence to Event Monitoring. This is alternative of Salesforce Event Log File Browser as some companies may block the URL .We can use Workbench to view the log file. Run the SOQL , you can use any tool to run SOQL. Developer Console should works also. SELECT Id,LogFile, EventType, CreatedDate FROM EventLogFile WHERE EventType IN ( 'API' , 'RestApi' , 'ApiTotalUsage' ) Login to Salesforce Workbench > Go to utilities > Choose REST Explorer and paste the LogFile URL that returns from above query and click Execute. It should something like below. Note that the yellow highlight is something that we need to alert because it's going to retire. To make it easy to read, just copy from EVENT_TYPE until at the end of the

Working on Process Builder and Flow with Effiency

It's long therefore I split it to different module that you can click instead of scroll, Problem statement Current Implementation Improved Implementation Problem statement I was working on requirement which involving on after trigger update and suddenly have to stop when I hit governer limit in Process Builder that not related to the current changes. Too many SOQL queries: 101 Usually when I got this type of error I will worry and start looking into my code which is not wrong approach at all. However it is good to start with the Process Builder that hinting the exception although the changes that we are working on seem like not relevant. Actually it is relevant when it involves process builder , flow , trigger and workflow (everything that involve DML) Let say that is current data model , please ignore the sense of  object name, field name as I just renamed it from actual name. Pay attention on the relationship. Product Proposal is a parent object of

Add event in LWC and Listen in Visualforce page

While reading this, you might have an idea how it should works and why ? In order to make it easy, I narrow down problem statement so I can write simple, short solution for future reference. All comments, ideas except spams are welcome. Problem Statement I have LWC which is embedded inside Aura and Aura is embedded inside Visualforce page. Why I come out with such design ? Due to that I am not able to use the cool NavigationMixin for redirection Now how do I redirect page ? Solution  Adding create event in LWC and add the listener to visualforce page Technical Implementation In LWC javascript , create event on function that handles redirection. For example maybe you want user to go to different page when the button is clicked. //function to redirect to opportunity detail handleOnOppLink (){ this . showLoadingSpinner = false ; //create new Event with any meaningful name, in my case 'redirectFromLWC' this . dispatchEvent ( n

Retrieve related id / parent id in Aura component when override standard New button

Currently this is not possible , please vote the idea Get parentId when overriding standard actions with a lightning components This currently doable by overriding New button using  Visualforce page. So we can retrieve Parent Id or any record field in Visualforce page and pass it to the Aura component.The workaround that works is by wrapping it inside Visualforce page. Basically it is the same for both Aura and LWC but I still put it here for my reference Example for Aura component < apex : page standardController = "MyObject" > < apex : includeLightning /> < div id = "lightning" /> < script > $Lightning.use( "c:lightApp" , function () { $Lightning.createComponent( "c:lightComp" , { opportunityId : "{!MyObject.Opportunity__c}" }, /*** here my parentId***/ "lightning" , function (cmp) { // do s