Posts

Image
Workspace API: How to get Record Id of Enclosing/Parent Tab Hi Folks,  I am back with another blog wherein I will discuss how to use Workspace API to get the Record Id of the Enclosing tab. (Basically the parent tab for the current subtab). Specifically in Salesforce Service Console apps when we click on any lookup value then that record's detail page opens in Subtab mode. For example when we click on Account Name from the Account Lookup field in the Case Record Page then we see that the Account Record Page is opened as a subtab under the current Case Record Page Situations can come where we want the Record Id for both the Account Id and the Case Id. We can easily get the AccountId via the recordId attribute. < aura:attribute name = "recordId" type = "Id" /> But how to get the CaseId, this value is present in the parent tab. This blog will give you the answer. Salesforce has provided Workspace API using which we can get this information out. We will dis...

Adding NPM module into LWC

Image
Importing NPM module into LWC Hi Folks, I am back with another post. This time I will be discussing the topic of how to add an NPM module into LWC. Although we all know that to make any 3rd party javascript work in Salesforce we need to have it into Static Resource. But I came into a strange situation wherein I had to use an npm module into LWC.  The issue that I was facing was that the NPM module was having several dependant files which were scattered into several folders and it would have taken me ages to read through all the codes, find the dependency and create a single JS file that is uploadable to static resource. After researching a lot got to know about the Browserify tool ( webpack is also there but browserify is easy to use). Using this tool you can just let the package know which JS file is the source file and  Browserify  will do the magic for you and create a single js file. Enough of talking. Now let's get to the technicalities with an example. :) I will d...
Image
Sticky Scroll to Top Button in LWC Hi Folks, This is a very simple requirement but often we get stuck and while googling about it we don't find a solid solution that would directly work in Salesforce LWC. Here I am writing my blog which can be used in your LWC directly, just need to follow the below points. Few points before jumping on to the entire code. We are going to use the Element.scrollTop property to control the scroll bar. This code works if you have a specific Scroll Bar for your element . Meaning you have added a custom scroll bar for your <div> How to do that? First, add a topmost div with a class and an onscroll method which would be able to calculate at which position is your scroll bar is currently. < div class = "top-most-div" onscroll = {onScroll} > <!-- All your other code--> </ div > Add the CSS for the top-container .top-most-div { overflow-y : scroll ; height :80 vh ; scroll-behavior : smooth ; } If you want ...