Category Archives: Salesforce Cookies

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

      No Comments 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 »

Salesforce Cookies #7

      No Comments on Salesforce Cookies #7

Calling a child lightning component method from the parent lightning component When we have multiple nested components then we may run into a scenario in which our parent lightning component is supposed to call a method of its child component. This is a very common use case. simplifies the code needed for a parent component to call a method on… Read more »

Salesforce Cookies #6

      1 Comment on Salesforce Cookies #6

Adding Loading Icon on the page for an AJAX Request ( ActionFunction, CommandButton) It’s always good to add a loading icon on the page when you are processing something on the server side (calling an apex method ) so a user can understand that something is running in the background. Following code snippet can be used along with your apex:actionFunction… Read more »