Category Archives: Salesforce Cookies

Salesforce Cookies #17

      No Comments on Salesforce Cookies #17

Recalculating Formula on a record without even querying the fields When you’re working in Triggers or in apex code, you may want to get a recalculated formula field values on a particular object. This can be done with the help of a method in the Formula class. Let’s have a look on syntax and an example to understand it. Things… Read more »

Salesforce Cookies #16

      No Comments on Salesforce Cookies #16

Overriding the LWC standard component’s style As we all know that LWC uses shadow DOM which makes an isolation between our custom components and LWC standard components. When you add a style to your component’s css file it doesn’t apply to the standard components and that’s a limitation. Example: Let’s say you have a lightning-textarea and you want to set… Read more »

Salesforce Cookies #15

      No Comments on Salesforce Cookies #15

How to use Salesforce REST API in Lightning Component If you are working with REST/SOAP APIs in the apex class which is being used in the lightning component, then using UserInfo.getSessionId() will give the session id which can not be used to make the API calls due to security restrictions. There is a workaround for this problem which uses Visualforce… Read more »

Salesforce Cookies #14

      No Comments on Salesforce Cookies #14

How to use Lightning component into a Visualforce page Sometimes, you might have a situation where you want to access your lightning component in the Salesforce classic view and here ltng:outApp comes into picture. ltng:outApp : Is a component in the long namespace which is used to expose your lightning component outside of the lightning experience. Sample Code View the… Read more »

Salesforce Cookies #13

      No Comments on Salesforce Cookies #13

How to validate fields in lightning components ( Form Validation in Lightning Component ) Some lightning components come with inbuilt validation and you need to trigger the validation in your client-side controller. Following components provide inbuilt validation support. lightning:input lightning:select lightning:textarea ui:input* lightning:input is more powerful when it comes to the validation as it honors the HTML5 validations too like… Read more »

Salesforce Cookies #12

      No Comments on Salesforce Cookies #12

How to remove the arrows from lightning:input[type=”number”]? I think this is a generic question and Salesforce devs have looked for the ways to get rid of the spin buttons on the input field without changing it to text type for a purely numeric┬ábehaviour. You just need a few lines of CSS to solve your problem. We need some CSS which… Read more »

Salesforce Cookies #11 ( Salesforce Admin Special )

Is there a way to mass-check Checkboxes when updating a Profile’s Object’s Field-Level Security? Of course, there is. You can do it through your browser’s console. You just need the following Javascript code snippet which will do the job for you. For the Edit Permission var checkboxes = document.querySelectorAll(“.displayedCol input”); for (var i = 0; i < checkboxes.length; i++) {… Read more »

Salesforce Cookies #10

      No Comments on Salesforce Cookies #10

Creating a dynamic SOQL which includes all the fields I have seen this question several times on developer forums and I thought it could be another addition to Salesforce cookies. If you are wondering how can you query all the fields of an object then you can use the following code snippet. View the code on Gist. The above code… Read more »

Salesforce Cookies #9

      1 Comment on Salesforce Cookies #9

Populating merge fields in Salesforce Email Template without sending the email / Preview Email Template Recently, I faced a challenge while working on a small project in which I had to send email through apex using email templates. I am calling it a challenge because of the problem I faced and I am sharing the solution/workaround I found for this…. Read more »

Salesforce Cookies #8

      No Comments on Salesforce Cookies #8

How to use namespace in managed lightning components If you are working on a lightning component and it’s going to be a part of a managed package then you need to take care of namespace in client side JS code if you are accessing any custom field. This can be handled in various ways but I found one very quick… Read more »